[RFC] Repository.get_file_texts API and planning for it
aaron.bentley at utoronto.ca
Wed Aug 15 16:04:29 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
John Arbash Meinel wrote:
>> Iterables of bytes is a very convenient one. Text lines is nice only
>> when working with text. File objects have high API demands, but even
>> strings are iterables of bytes.
> You've said this in the past, and while I agree it is convenient, it has
> some odd performance characteristics. Specifically (edited for clarity):
I've no doubt it does.
> So while I agree that iterable of bytes is a convenient and very
> adaptable api. We really don't want to be passing a plain string to that
It is very convenient for test cases, though.
So we can
1. recommend wrapping strings in lists (or maybe tuples-- how fast are
2. automatically wrap strings in lists/tuples as an optimization.
But I should say that passing in a single string to create_file suggests
that you're not being memory-efficient, because you must have read a
whole file into memory.
So there are other reasons than writelines performance to avoid this in
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar