[sugar] [PATCH] Avoid duplicates in the bundle registry

Michael Stone michael
Tue May 27 12:44:36 EDT 2008


On Tue, May 27, 2008 at 09:15:39AM +0200, Tomeu Vizoso wrote:
> +        for bundle in self._bundles:
> +            if new_bundle.get_bundle_id() == bundle.get_bundle_id():

Why are we performing repeated linear search instead of storing bundles
in a datastructure with sub-linear containment lookups (e.g. a set or a
hashtable)?

> +                if new_bundle.get_activity_version() <= bundle.get_activity_version():

Why exclude old bundle versions? 

Have you reviewed any of the bundle commentaries that Eben, Jameson, and
I have been writing?

  http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_1
  http://wiki.laptop.org/go/User:Mstone/Commentaries/Bundles_2

Michael



More information about the Sugar-devel mailing list