[MERGE] bzrlib.osutils fixes

Robert Collins robertc at robertcollins.net
Mon Mar 12 20:30:39 GMT 2007


On Mon, 2007-03-12 at 10:44 -0500, John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert Collins wrote:
> > On Sun, 2007-03-11 at 10:12 -0500, John Arbash Meinel wrote:
> >> The downside is just in parsing. So now you have to map things rather
> >> than just reading them. So we should at least know what the
> >> performance
> >> effect is on DirState if we have to convert from our single character
> >> to
> >> an object. But we don't have to *create* the object, so I don't think
> >> it
> >> will kill us. But it is another function call and hash lookup in a
> >> critical loop.
> > 
> > Huh? in the top of dirstate.py, we can do
> > _mini_kind_to_kind = {'k':path_info.kind_directory,
> >  't':path_info.kind_tree,
> >  ...}
> > 
> > And then use that as we were. I dont see why there is a function call
> > involved.
> 
> That *is* the function call. (The dict lookup). But as I said, it
> probably isn't terrible. I would just like us to specifically measure
> it, rather than guessing.

Well, it is a dict lookup, but OTOH it saves us multiple dict lookups
later - 'versionable' and 'marker' are both checked, versionable for all
paths and marker for ones shown to the user. Using _slots_ these later
accesses should be very cheap indeed.


> One thing that I recall from David's work, is that by switching to
> pyrex, you can call PyDict_GetItem (or whatever), rather than
> PyObject_GetItem. Which is supposed to make a rather large difference.
> 
> And for the record, this *is* quite a bit easier than what I've seen
> done for other wrappers. (Raw C extensions, or Boost::Python). Which is
> as I would have hoped.

Yes, you can do that; in fact I can add that to path-info and profile it
later. Right now, I'm aiming at the bulk of python code that is slowing
dirstate down.

Cheers,
Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070313/ee125118/attachment.pgp 


More information about the bazaar mailing list