Finding slowdowns in pkg_install

Michel Talon talon at lpthe.jussieu.fr
Fri Jul 6 17:56:31 UTC 2007


Tim Kientzle said:

> One approach I prototyped sometime back was to use
> libarchive in pkg_add as follows:
>    * Open the archive
>    * Read +CONTENTS directly into memory (it's
> guaranteed to always be first in the archive)

I can only concur with that. In my program
http://www.lpthe.jussieu.fr/~talon/check_pkg.py
i discovered that memory mapping +CONTENTS and then working
in memory before rewriting it was around 5 times faster
than reading line by line and parsing each line. See function
fix_pkg_database(). By the way i am writing a new +CONTENTS
fileand then renaming it, which avoids leaving a mess if
something goes astray like portupgrade does.


-- 

Michel TALON



More information about the freebsd-hackers mailing list