[MERGE] bzrlib.osutils fixes

John Arbash Meinel john at arbash-meinel.com
Fri Mar 9 14:50:09 GMT 2007


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

Dmitry Vasiliev wrote:
> 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.
> 

I also think Aaron didn't realize this was just in the test suite. This
wasn't actually part of day-to-day code.

Optimizing the test suite can be useful, but isn't a primary focus.

The primary focus is optimizing the internals of bzr.

John
=:->

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

iD8DBQFF8XQhJdeBCYSNAAMRAg9JAJ4gMaA6gXCeDAtGQKrBCBurXo5uwgCaA2O/
HiUp5Ji2/RNki3nB8wDeuC8=
=9Yzh
-----END PGP SIGNATURE-----



More information about the bazaar mailing list