Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Re: [Python-checkins] cpython: Issue #14687: str%tuple now uses an optimistic "unicode writer" instead of an

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


tjreedy at udel

May 3, 2012, 9:13 AM

Post #1 of 2 (103 views)
Permalink
Re: [Python-checkins] cpython: Issue #14687: str%tuple now uses an optimistic "unicode writer" instead of an

On 5/3/2012 7:16 AM, victor.stinner wrote:
> http://hg.python.org/cpython/rev/f1db931b93d3
> changeset: 76730:f1db931b93d3
> user: Victor Stinner<victor.stinner [at] gmail>
> date: Thu May 03 13:10:40 2012 +0200
> summary:
> Issue #14687: str%tuple now uses an optimistic "unicode writer" instead of an
> accumulator. Directly write characters into the output (don't use a temporary
> list): resize and widen the string on demand.

I am curious whether these optimizations for str % tuple get applied to
equivalent str.format(*tuple) calls or if you plan to make them do so.
It seems to me that there could be one internal function that does the
concatenation, with lengthening and resizing, of literal and formatted
substrings, for both interfaces.

tjr
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


victor.stinner at gmail

May 3, 2012, 3:12 PM

Post #2 of 2 (94 views)
Permalink
Re: [Python-checkins] cpython: Issue #14687: str%tuple now uses an optimistic "unicode writer" instead of an [In reply to]

>> http://hg.python.org/cpython/rev/f1db931b93d3
>> changeset:   76730:f1db931b93d3
>> user:        Victor Stinner<victor.stinner [at] gmail>
>> date:        Thu May 03 13:10:40 2012 +0200
>> summary:
>>   Issue #14687: str%tuple now uses an optimistic "unicode writer" instead
>> of an
>> accumulator. Directly write characters into the output (don't use a
>> temporary
>> list): resize and widen the string on demand.
>
> I am curious whether these optimizations for str % tuple get applied to
> equivalent str.format(*tuple) calls or if you plan to make them do so. It
> seems to me that there could be one internal function that does the
> concatenation, with lengthening and resizing, of literal and formatted
> substrings, for both interfaces.

I just wrote a patch for str.format().
http://bugs.python.org/issue14716

The speed up is between 0% and 27%.

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.