Okay, hit this one today and it seems weird/buggy.

I'm unsure whether it's pkg_info itself or some artifact of perl's
runtime, but I had cause to slap ktrace on pkg_info and while
browsing through the kdump info, I discovered that it was doing a
stat(2) on every file in the $CWD.

To reproduce:

  $ mkdir -p ~/tmp/poc/{empty,full}
  $ cd ~/tmp/poc/full
  $ jot 100 | xargs touch
  $ ktrace -f ../full.ktrace pkg_info -Q remind
  $ cd ../empty
  $ ktrace -f ../empty.ktrace pkg_info -Q remind
  $ cd ..

then

  $ for f in full.ktrace empty.ktrace ; do echo -n $f ; kdump -f $f": " | grep 
-c 'NAMI *"\.' ; done

(remove the -c for the self-evident file-listing)

On large directories with tens of thousands of files in them
(especially on spinning-rust HDDs rather than flash media), this
has a noticeable delay.

So it seems buggy that the performance of pkg_info depends on the
number of files in the current working directory.  Especially since
pkg_info should almost certainly have no reason to be statting my
current directory.

-tkc
-- 





Reply via email to