
On Mon, Jan 23, 2006 at 08:37:55PM -0800, Jason Dagit wrote:
On Jan 23, 2006, at 3:33 AM, Bulat Ziganshin wrote:
what you mean? afaik, there is no standard FastPackedString implementation, but there is some library that with minimal modifications used in darcs, jhc and many other apps
I considered the version at Don Stewart's web site to be the standard, perhaps that was silly of me.
Actually, FastPackedString originated in darcs, and Don separated it out as a library, making minimal modifications... :) FastPackedString started out with the Data.PackedString code, which I modified to hold the data in a ForeignPtr and to treat the data as always being 8 bit words. Plus the mmap stuff and splitting. I renamed it when I deviated from the Data.PackedString interface (which is the module I used to use).
it seems that Ian just used this as memory/time-efficient alternative for hGetContents. reading from memory-mapped file may be done as pure computation if the whole file is mapped. is this used in darcs?
I'm not sure, I have looked at the code but I can't tell. I think that was the point with the mmap'd files. There are several layers of abstraction at work here. Slurpies, PackedStrings, (custom) Lazy Reader monad, and maybe some others.
Patch files are normally stored compressed, so we can't mmap them and treat them nicely. For crazy-size repositories one might prefer to store them uncompressed, at least on one's working repository (presumably not in the publicly available repo). If the patches aren't compressed, they are indeed mmapped as an entire file. And alas, even I don't have much time at the moment to help with optimizing darcs. -- David Roundy http://www.darcs.net