Re: [Lxr-dev] Status of this project?
Brought to you by:
ajlittoz
From: Paul S. <ps...@ne...> - 2007-03-19 02:04:50
|
On Sun, 2007-03-18 at 17:04 +0100, Jan-Benedict Glaw wrote: > Great. Care to send some patches for review? Sure; here's a patch. It avoids reading the entire contents of the file until after we know we're going to need it. In my source tree I have a number of very large binary files (cross-compilers and similar things), and the old method of reading the entire contents of the file into memory first was extremely wasteful of system resources, not to mention very slow. Personally, I'd like to see the entire LXR::Files class reimplemented. IMO, the right way to do that is to have a class that represents a single file, where you'd run something like: $file = LXR::File->new($path, $release); and get back an object reference for that file. Then you'd run things like: $fh = $file->gethandle(); $size = $file->getsize(); $path = $file->getpath(); etc. The really nice thing about this is that when $file goes out of scope, there's a destructor invoked automatically by Perl that you can use to clean up any open filehandles, temporary copies of files you had to create from CVS or GIT, etc. etc. Currently, that all has to be done by hand which is a pain, not to mention error-prone. I've done a LOT of Perl hacking over the years. If people are amenable to these kinds of changes I'd be happy to make them. |