On Wed, Aug 26, 2009 at 5:21 AM, <[email protected]> wrote: > On Tue, Aug 25, 2009 at 07:20:41PM -0700, Alan Coopersmith wrote: >> [email protected] wrote: >> > This one is a bit tough, since there isn't a SysV packaging command to >> > find the package that a file belongs to. >> >> "pkgchk -l -p /usr/bin/ls" - only works on exact paths, not patterns though. > > Thanks Alan. I forgot about pkgchk. > > On jurassic, I get a ptime of the following for that command: > > real 2.437435597 > user 0.474447459 > sys 0.374507290 > > That is still faster than pkg search, but not by 12x. > > It looks like there's some amount of scaling depending upon how many > packages are installed. On my system, which has no SysV packages, the > command only too .04 seconds of real time to complete.
That's pretty slow. How many packages are installed on jurassic? pkgchk does an inefficient linear scan of contents - a reasonably large file. On one of my slower x86 boxes running S10: real 0.268 user 0.226 sys 0.040 There's significant amounts of low hanging fruit here. Simply optimizing the file reading can get you quite a lot (it's about 30% faster in SXCE than S10 already); given that the contents file is sorted, you can do a binary chop (the pkg code already supports that; for some reason pkgchk doesn't use it) which gives you a factor 100 or so speedup. For comparison, on a similar OpenSolaris system, I get for 'pkg search -l /usr/bin/ls' real 2.410894026 user 2.193307654 sys 0.178723100 (that's after rebuilding the index and repeatedly running it to get the system warm - without that it's 10 times slower again). The performance of pkgchk is sufficiently dire that most of us use grep on the contents file instead. Needless to say, losing an order of magnitude or two over that doesn't really enthuse us. -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
