use namedtuple for iter_changes
Bug #802533 reported by
Jelmer Vernooij
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.
tags: | added: check-for-breezy |
To post a comment you must log in.
-----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 enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk4 K2tEACgkQJdeBCY SNAAPUjQCfXDN/ IXSICr50enF5s96 dssTh KEzBnO0Sd1Bbjq+ TN4iL4up
w6AAn0SN/
=Y0r3
-----END PGP SIGNATURE-----