[pacman-dev] [Bulk] [PATCH] Read .PKGINFO directly from package file
K. Piche
kpiche at rogers.com
Sat Mar 29 18:57:12 EDT 2008
On Sat, 2008-03-29 at 14:39 -0500, Dan McGee wrote:
> On Sat, Mar 29, 2008 at 2:36 PM, K. Piche <kpiche at rogers.com> wrote:
> > Interesting. I was in the process of reading the whole file into a
> > buffer and having parse_descfile parse that. Oh well...
>
> That is quite similar to Xavier's patch that keeps an internal buffer
> in archive_fgets() in order to reduce calls into libarchive, which
> seems to cut the time by half to parse the entire community DB (.12 vs
> .07 seconds locally on my desktop machine).
True. We know how large the file is during the archive read from the
entity struct so I figured it would be easier to malloc a buffer and pop
the whole file in it. Parsing the buffer it would have required
strdup'ing lines but no code would be required for overrunning a line
buffer - all sizes are known.
As an aside: is there any interest in some unit testing code? I've
looked at the check library and written a few tests for the alpm_list
stuff. Unfortunately a lot of our functions are difficult to test
individually. For instance instead of passing a buffer with test data
to test parse_descfile you need to pass an archive.
> No matter how you cut it, not writing a temp file definitely saves time.
>
> -Dan
>
> _______________________________________________
> pacman-dev mailing list
> pacman-dev at archlinux.org
> http://archlinux.org/mailman/listinfo/pacman-dev
--
K. Piche <kpiche at rogers.com>
More information about the pacman-dev
mailing list