A sick idea - mmapped file output

Richard Henderson rth@cygnus.com
Thu Nov 2 23:30:00 GMT 2000


On Thu, Nov 02, 2000 at 09:40:53PM -0800, Zack Weinberg wrote:
> - Do you have any suggestions for what to do when you run off the end
>   of the mapping?  Bonus points if your idea doesn't involve MAP_FIXED,
>   and/or if it works with the signal approach.

I don't think any sorts of timing are valuable unless you
handle the overflow case somehow.  Further, you should test
against a straightforward write implementation so that you
don't get to thinking that mmap is better than it is.
Further, the output file will basicly never be a multiple
of the chunk size, so you should have to handle that as well.

I've appended a program to do just that.  The mmap case is
basicly the same as your "clever" case.  There is an if 0
to control whether or not MAP_FIXED is used (for the re-map
only, which I imagine works everywhere).

With this I get:

i686-linux (hz=100)
        usr     sys     wall
mmap    2       6       7
write   3       3       7

alphaev6-linux (hz=1024)
        usr     sys     wall
mmap    25      30      55
write   30      21      51

sparc-solaris2.5.1 (hz=?)
        usr     sys     wall
mmap    8       3       18
write   7       5       45

mips-irix6.5 (hz=?)
        usr     sys     wall
mmap    5       4       10
write   6       3       9

powerpc-aix3.4 (hz=?)
        usr     sys     wall
mmap    4       1       19
write   3       6       11



r~


More information about the Gcc mailing list