[MERGE] bzrlib.osutils fixes

Robert Collins robertc at robertcollins.net
Sun Mar 11 21:40:09 GMT 2007


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.

> 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

-- 
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/20070312/8b51580d/attachment.pgp 


More information about the bazaar mailing list