On Tue, Nov 27, 2007 at 02:05:35PM -0800, Scott Stanton wrote: > > > Steffen Mueller wrote:
> > That is certainly the most elegant way to speed up PAR startup. It's > one > > of the longest standing criticisms that we don't do it that way. > > Nicholas Clark's ex::lib::zip does this loading from memory using XS, > if > > I remember correctly. I don't remember whether or how it deals with > > shared object files. It probably does. It doesn't deal with shared object files. It feeds things straight to the parser without using temporary files or even whole file in memory buffers. However, it does honour <DATA> handles, so it should be possible to pack shared libraries as files that get required and supply the binary content after __DATA__, for some helper code to write out to disk. (Could use File::Copy for that) > I took a quick look and I don't see anything that is explicitly dealing > with object files. It's also based on the gzip library rather than zlib > so it's not a drop in replacement. It is zlib, yes, but it contains code sufficient to read zip file central directories and headers. (Which, from what I remember of infozip at that time, was not as efficient as it could be. They were reading byte by byte, and error checking on each, whereas I used fread() to grab entire headers in one go, which reduces the number of places where IO failure needs to be checked for) It incrementally scans the central directory, caching everything it meets before it finds the requested file, and as it's all in C I'd hope that it's rather fast. (But there is the small matter of distributing it first, which I assume the "classic" PAR can deal with, if one doesn't want to supply a perl binary static linked against it (and PerlIO::gzip and PerlIO::subfile)) Nicholas Clark
