On Wed, Jun 15, 2011 at 01:49:30PM +0300, Timo Teräs wrote: > Hi all, > > As recently discussed on the 'Significant performance problems with > modprobe', the config_* and xmalloc_fget* API has some performance issues: > 1. It uses locking getc > 2. It does malloc/realloc/free for each line read > > Now (1) is relatively simply fixable with getdelim(), getline() or > getc_unlocked(). And even get_line_from_file.c has comments that fixing > of (1) should about double the speed.
The difference between getc_unlocked and getc should be fairly small. If getc_unlocked is a macro, probably at best 2.5-3x, and if it's a function, probably at best 1.5-2x. getline/getdelim would make a much bigger difference. > However, (2) is trickier, because the whole API is designed exactly for I'm not convinced that (2) has any bearing whatsoever on performance unless you're using some hideous malloc implementation that calls mmap for each allocation. Most calls to malloc (when new brk/mmap isn't required) should cost about the same as most calls to getc (when buffer isn't empty). Rich _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
