[pacman-dev] [RFC] pactree rewrite in C
dpmcgee at gmail.com
Mon Oct 11 09:32:00 EDT 2010
On Mon, Oct 11, 2010 at 8:06 AM, Dave Reisner <d at falconindy.com> wrote:
> The recent patchwork over the weekend inspired me to take a closer look
> at pactree. My first impression was that it would be a great candidate
> for a rewrite in C.
> Results are entertaining:
> # bash version
> $ time pactree -r glib2 >/dev/null
> real 0m2.538s
> user 0m1.593s
> sys 0m0.435s
> # C rewrite
> $ time ./pactree -r glib2 >/dev/null
> real 0m0.016s
> user 0m0.007s
> sys 0m0.009s
> I'm finding that it's even slightly more accurate than the bash version
> WRT to reverse dependency tracking as it's hooking into alpm's
> alpm_pkg_compute_required_by() instead of wandering through the file
> It's feature complete compared to the Bash version, aside from the
> export to graphviz. The only functional change I've made is: when
> walking reverse depends, don't re-walk already visited dependencies. I
> thought this was a logical change given the behavior of the standard
> dependency tracking.
> I'm happy to offer this up for merging if desirable. There's a few ugly
> bits in the code I still want to refactor -- if anyone has any comments
> or criticisms, they're very welcome.
Didn't look at the code yet, but:
1. Tools that look at the database directly are bound to be broken in
the near future anyway- some of this stuff is going to get redone, so
we should be doing all interaction via libalpm.
2. As far as graphviz/dot, I think the feature would be more
interesting anyway if it just generated the graphviz input rather than
actually invoking graphviz. That should be easy to implement.
So I at least give a +1 to this, and we can move it into src/util/
like vercmp to make it easier to build and such.
More information about the pacman-dev