memory-mapped files
bearophile
bearophileHUGS at lycos.com
Tue Feb 17 18:31:38 PST 2009
Andrei Alexandrescu:
> Indeed, time and again, "testing is believing".
Yep. Time ago I have read that the only science of "computer science" is in things like timing benchmarks and the like :-)
> foreach (line; byLineDirect(stdin))
I don't like that byLineDirect() too much, it will become one of the most used in scripting-like programs, so it deserves to be short&easy.
> write(r.head, ":");
Something tells me that such .head will become so common in D programs that my fingers will learn to write it while I sleep too :-)
> r.next;
.next is clear, nice, and short. Its only fault is that it doesn't sound much like something that has side effects... I presume it's not possible to improve this situation.
>What the heck is going on? When does memory mapping actually help?<
You are scanning the file linearly, and the memory window you use is probably very small. In such situation a memory mapping is probably not the best thing. A memory mapping is useful when you for example operate with random access on a wider sliding window on the file.
Bye,
bearophile
More information about the Digitalmars-d
mailing list