On Fri, Feb 01, 2013 at 01:44:53PM -0800, Bart Smaalders wrote:
> On 02/01/13 11:25, Edward Pilatowicz wrote:
> >hey all,
> >
> >i have a small bugfix (9 lines of actual code) that speeds up noop pkg
> >operations:
> >
> >     https://cr.opensolaris.org/action/browse/pkg/edp/pkg.lisyncfast/webrev/
> >     16269426 noop pkg operations are slow
> >
> >i benchmarked the fix on my desktop with the following command:
> >
> >     ptime pkg install --no-refresh -n osnet-incorporation
> >
> >without the fix execution time was 1 min and 24 sec, with the fix
> >execution time was 12 seconds.
> >
> >more details about the analysis/fix are in the bug report.
> >
> >ed
>
> Hi Ed -
>
> Nice find...
>
> imageplan.py:
>
>
> line 2209:  nit: s/# if/# If
> line 2213:  nit: s/todo/to do
>
> line 2219 - 2221:
>
>       Seems like return defaultdict(set, self.pd._cfg_mediators)
>
> would achieve the same thing, no?
>

done, done, and done.

> if you wish, you could indent 2983 through 3008  one level right,
> but w/ our indent level that's gonna cause problems.
>

yeah.  the indentation is the reason i didn't do that.  (also, the
variable is uniquely enough named that a simple search allows you to
quickly verify it's being used correctly.)

that said, i'm still not crazy about the fact that i'm now
declaring/initializing a variable in a parallel scope to where it's
being used.  hence, i've added a variable declaration to the parent
scope of where it's being referenced.  ie:

---8<---
+               l_actions = {}
                if self.pd.update_actions:
+                       # iterating over actions is slow, so don't do it
+                       # unless we have to.
                        l_actions = self.get_actions("hardlink",
                            self.hardlink_keyfunc)
                for a in self.pd.update_actions:
                        ... l_actions is used here ...
---8<---

the webrev has been updated.

thanks for the review,
ed
_______________________________________________
pkg-discuss mailing list
pkg-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to