mmap support in stdio

Ulrich Drepper drepper@redhat.com
Mon Jan 7 01:43:00 GMT 2002


You might have seen the changes I just checked in, they add
transparent support for the use of mmap in stdio.  mmap is only used
of read-only streams.  It is theoretically possible to use mmap also
otherwise but this is so much more complicated that I don't even want
to think about it.  One oddity of the code is that I've limited the
size of files handled this way to one 1MB on 32-bit machines.
Otherwise the address space might fill up too quickly.  The number
(1MB) is pure guessing.  Maybe it'll have to be changed in future.

As for the benefits: I've measured about 10% speed-up on large files.
Smaller files should benefit less.  This also shows that the original
code is already pretty well optimized.

The code certainly needs testing but at least all the tests in libio/
and stdio-common/ pass.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Libc-hacker mailing list