[SDL] Re: CVS Update (SMPEG ported to Win32)
pphaneuf at sx.nec.com
Thu Apr 13 12:39:34 PDT 2000
Mattias Engdegård wrote:
> > Well, there's nothing non-portable about memory mapping, per se, and
> > it should be a big speed win. Sam, any specifics?
> Sexy as mmap is, it isn't always faster. I included an explanation from some
> kernel hacker below. Morale (as always): profile, profile, profile!
For small files, it *really* isn't good. But for a huge file, I think
you win overall. For example, Apache has a threshold size to decide
whether to mmap or to just read the file. If the file is large enough,
it gets mmap()ed.
For some things also, as Linus explained, it is a big win. My favorite
use is for my resource file: the content is in "ready to use" form, I
just need a pointer to it and there I go! Also, I get automatic sharing
for free and as he mentioned, memory pressure is automatically managed
by the kernel, forgetting and reloading pages as needed!
More information about the SDL