[MERGE] Faster 'build_tree'

Aaron Bentley aaron.bentley at utoronto.ca
Thu Jul 26 17:26:12 BST 2007


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

John Arbash Meinel wrote:
> Aaron Bentley wrote:
>> Also, if we have_get_text_map, does _get_contents_map need to return a
>> text map?  I think we can remove that.
> 
> I believe there are other users of _get_contents_map, but if not, then yes, we
> can get rid of it. I'll look around.

I mean that we can make _get_contents_map return only a contents map.  I
didn't mean completely eliminating the method.

> I'm actually thinking about removing _get_text_map() entirely, since it is
> focused on extracting multiple entries. When all we really want is a fast way
> to extract a *single* entry. (get_lines()).

I never figured the overhead would be that big.

>>      def get_file_text(self, file_id):
>>          file_id = osutils.safe_file_id(file_id)
>> -        return ''.join(self.get_file_lines(file_id))
>> +        ie = self._inventory[file_id]
>> +        weave = self._get_weave(file_id)
>> +        return weave.get_text(ie.revision)
> 
>> ^^^ Was this just a drive-by?  (You don't seem to use it anywhere.)

> Yep. Part of the work was to get "get_file_lines()" and "get_file_text()" and
> "get_file()" properly used everywhere. And it made more sense to have
> RT.get_file_text() go down to the lower api, rather than having it go through
> its own function. I was at least considering having a faster form for
> extracting the actual text (rather than lines). Though at the moment it isn't
> strictly necessary.

If it was essentially doing this already, it seems questionable to add
extra code.  Saving a function call isn't a very big win for these
operations.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGqMsk0F+nu1YWqI0RAg6vAJ4kQ8HH5u/WOUTHiKyK5oEEj+XSkwCgg9hH
XBbJXC+O0hUC1BIaEXVW0zQ=
=mhLS
-----END PGP SIGNATURE-----



More information about the bazaar mailing list