[MERGE] bzrlib.osutils fixes

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Mar 9 14:44:50 GMT 2007


Aaron Bentley wrote:
> Dmitry Vasiliev wrote:
>> John Arbash Meinel wrote:
>>> I understand why tuple versus list doesn't matter, (because we just
>>> re-generate it as a different tuple later) but it may be better to
>>> have an explicit comment about it.
>> Done in the attached version.
> 
> Also, Robert has some notes that tuples are 5x faster than lists.
> 
> http://bazaar-vcs.org/RobertCollins
> 
> So depending on how frequently this code is used, it might be more
> efficient to do:
> 
>                  new_dirblock = []
>                  for info in dirblock:
> 
>                      self.assertIsInstance(info[4], unicode)
>                      new_4 = info[4].encode('utf8')
>                      new_dirblock.append(info[:4] + (new_4,) +
>                                          info[5:])
>                  dirblock = new_dirblock

I believe the code processes only 5 tuples at all at each 'bzr selftest' 
run so the fix just need to be as simple as possible. Moreover  the code 
above is definitely slower than the my fix and I don't believe the 
result code will be any faster.

-- 
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru



More information about the bazaar mailing list