Hi,
>Please excuse a "not necessarily linux" question, but who wants to share
>opinions/experience on the virtues of mmap ing a file as opposed to opening it
>? I'm about to start work on a project where the local custom is to mmap input
>files and I'm not so sure that's a good idea (the files and 100s of meg).  Are
>page faults really that much faster than reads ?

This is a linux question. Well, programming, but who writes programs for
anything else, right;-)?
Gee, this was a good question...didn't let me go to bed. I was wondering how
much faster it is: 
4,000,000 bytes:
   mmap:Elapsed time:  4.820 seconds
   open,write,etc:Elapsed time:  16.780 seconds

60 megs:
    Elapsed time:  112.200 seconds
    Elapsed time:  263.770 seconds
Somewhat faster:-).
I didn't attach the file because it's pretty long for a mail list. Maybe I made
some mistake because it's late/early, but I don't think so. What I did was
that I created the files, filled it with ints, and then closed it (unmaped
too), and then opened again, and read the whole thing back. I have only 60 megs
free space, that's why the limit is that. I didn't even use fprintf and stuff,
just pure write and read. No optimalization either:
gcc -c -O mm.c
gcc -c -O timer0.c
gcc mm.o timer0.o -o mm 
Kernel 2.2.13, i386.
Conclusion: The guys who have been working on that project for years probably
have some experience.

Ferenc

**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to