On 06/09/2012 10:25 PM, Rich Felker wrote: > While fixing the underlying freadahead function would be nice, it > might be better to make sense of WHY it's needed/wanted, if it's even > actually useful, and how to avoid the need for it in the first place.
GNU M4 (at least the master branch, although it has not yet been released as m4 2.0) _wants_ to use freadahead, because it provides at least a 10% speedup in operation. It _really is_ more efficient to peek at the current buffer in one function call than it is to call multiple fgetc_unlocked(), in order to rapidly search for the next character of interest. If nothing else, you would be wise following the lead of Dragonfly and providing an internal __freadahead function with the semantics that gnulib wants, if you don't want gnulib messing around with FILE* internals directly, because it really does provide noticeable improvements. Furthermore, I'm considering writing a proposal for the next version of POSIX to standardize several of the stdio functions currently provided by gnulib, along with rationale why they are useful and how they can be used to speed up programs. The fact that gnulib is an existing implementation on top of multiple stdio implementations should be reason enough to treat it as something worth making standard. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature