#576915 30store-metadata: use GNUisms to achieve 1s runtime.

#576915#5
Date:
2010-04-08 08:28:04 UTC
From:
To:
Using Darcs, etckeeper pre-commit was annoyingly slow.  Profiling
pre-commit.d, I found about 3s were spent running readlink(1) on each
link in /etc/, though there were only 590 links.

Fortunately, GNU find supports -printf, so readlink(1) isn't required.
Similarly, the stat(1) per chown/chmod/chgrp entry isn't required.

Finally, I wanted .etckeeper to ignore backup~ files.  I added -name
\*~ -o to $NOVCS, which required turning it into a wrapper function.
Ugly, but at least it's applied consistently to all find(1) calls
(cf. filter_ignore).  I threw in an -O2 for the hell of it.

Before:

    # time sh -c 'etckeeper pre-commit; etckeeper pre-commit; etckeeper pre-commit'

    real    0m10.402s
    user    0m1.200s
    sys     0m2.536s

After:

    # time sh -c 'etckeeper pre-commit; etckeeper pre-commit; etckeeper pre-commit'

    real    0m2.770s
    user    0m1.284s
    sys     0m1.500s

Feel free to WONTFIX this if you have a "no GNUisms" policy.

#576915#10
Date:
2010-04-08 20:32:14 UTC
From:
To:
Trent W. Buck wrote:

I heard just today from someone using etckeeper on Solaris.
I don't remember if GNU find is available there by default.

It should be done for all the finds, AFAICS.