[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#578074: python-apt: apt.cache.Cache.get_changes could be faster



On Wed, Apr 21, 2010 at 04:16:48PM +0200, Julian Andres Klode wrote:
> On Wed, Apr 21, 2010 at 08:30:29AM +0000, unknown wrote:
> > Currently the get_changes call requires to create several thounsands high
> > level apt.package.Package instances just to check which changes are
> > marked.
> OK, your patch reduced the time to 130 ms here. I rewrote it partially
> and used a simple "not marked_keep(pkg)" to identify whether a package
> has been changed. This reduces the time this method needs to about
> 17 ms. The patch landed in revision 400:
>   http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/revision/400
> 
> Furthermore, req_reinstall_pkgs now requires 40 ms instead of 700 ms:
>   http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/revision/403
> 
> And get_providing_packages() now takes 60 µs instead of 700 ms:
>   http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/revision/404
> 
> I ran tests on all of them to verify that they behave exactly like
> their old versions.
> 
> Have fun.

Great! It is really amazing how much you can get out of a small code
optimization. It would be also nice to have a get_upgradables method or an
upgradables property for the apt.Cache. Getting the list of 
upgradbale packages is my second most important iteration on the package
cache after the changes. I would like to make use of the internal API
here too.

Cheers,

Sebastian

Attachment: signature.asc
Description: Digital signature


Reply to: