Faster file descriptor allocation

Skip Ford ported Tim Robbins’ FreeBSD port of Niels Provos’ NetBSD file descriptor allocation code. Normally I don’t post about code until it gets committed, but he posted some numbers on how well it improves things, as benchmarked by Niels Provos’ test program that opens/closes files repeatedly. The numbers seem to indicate a 50% speedup:

File DescriptorsUnpatchedPatched
10.7656500.781279
20011.1484840.789092
40011.5469350.765657
60012.0625820.781276
80012.5157250.796906
100013.0860610.796904
120013.6329550.765654
140014.0860980.757841
160014.5158050.820343
180014.9767590.812530
200015.4299160.796905
220015.8986520.773467
240016.3361880.773455
260016.7502680.804718
280017.1799720.789091
300017.6331100.781281
320018.0706320.789091
340018.5237710.796906
360018.9534790.789092
380019.3753700.765656
4000110.1175870.789090
4200110.7582380.789091
4400111.3676360.804718
4600111.8207810.812531
4800112.4536180.812530

One Reply to “Faster file descriptor allocation”

  1. Jeroen says:

    Seems more like the code first was O(n) and now its O(1).

Comments are closed.