use namedtuple for iter_changes

Bug #802533 reported by Jelmer Vernooij
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

now that we have started relying on python 2.5, we can use namedtuples. This would be in particular useful for the return value of iter_changes() of which the order of the elements is hard to remember.

Analysing the performance of namedtuples for dulwich, we seemed to get similar performance as for regular tuples. We might also want to do a StaticNamedTuple or something like that.

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 802533] [NEW] use namedtuple for iter_changes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/27/2011 3:23 PM, Jelmer Vernooij wrote:
> Public bug reported:
>
> now that we have started relying on python 2.5, we can use namedtuples.
> This would be in particular useful for the return value of
> iter_changes() of which the order of the elements is hard to remember.
>
> Analysing the performance of namedtuples for dulwich, we seemed to get
> similar performance as for regular tuples. We might also want to do a
> StaticNamedTuple or something like that.
>

I'm pretty surprised for your performance analysis. If we are going to
change it, I would actually say we should just create a regular pyrex
class, and if we want to maintain compatibility, it can support
__getitem__ and __len__. So more how Stat objects work.

We probably still need to investigate getattr overhead vs __getitem__
overhead, but I would certainly like to work in a named-attribute interface.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4K2tEACgkQJdeBCYSNAAPUjQCfXDN/IXSICr50enF5s96dssTh
w6AAn0SN/KEzBnO0Sd1Bbjq+TN4iL4up
=Y0r3
-----END PGP SIGNATURE-----

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.