[MERGE] bzrlib.osutils fixes

John Arbash Meinel john at arbash-meinel.com
Mon Mar 12 15:44:11 GMT 2007


-----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.

> 
>> Also, there is the need for a C extension to grab the Python object,
>> so
>> that it can return it. Which is certainly possible, just more
>> difficult
>> than passing around python basic types. (I'm guessing that pyrex makes
>> this a lot easier, though).
> 
> In pyrex its:
> import path_info
> _kind_directory = path_info._kind_directory
> 
> at module scope.
> 
> If we wanted to microoptimise it, its trivial I think (I haven't tested
> this yet):
> import path_info
> _kind_directory = path_info._kind_directory
> cdef void * local_ref_kind_dir
> local_ref_kind_dir = <void *>_kind_directory
> 
> -Rob
> 

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.

John
=:->

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

iD8DBQFF9XVKJdeBCYSNAAMRAuMZAJ93WUVNHQiSGQEJXz9gukw26v32EACcCD1V
CFmsWPfyv0xEROlVQIyv05Q=
=1vkU
-----END PGP SIGNATURE-----



More information about the bazaar mailing list