[Python-Dev] Optimize Unicode strings in Python 3.3
Serhiy Storchaka
storchaka at gmail.com
Wed May 30 11:32:53 CEST 2012
On 30.05.12 01:44, Victor Stinner wrote:
> The "two steps" method is not promising: parsing the format string
> twice is slower than other methods.
The "1.5 steps" method is more promising -- first parse the format
string in an efficient internal representation, and then allocate the
output string and then write characters (or enlarge and widen the
buffer, but with more information in any case). The internal
representation can be cached (as for struct module) that for a repeated
formatting will reduce the cost of parsing to zero.
More information about the Python-Dev
mailing list