On 2012-01-03, Neil Cerutti <ne...@norwich.edu> wrote:
> On 2012-01-03, Stefan Krah <stefan-use...@bytereef.org> wrote:
>> Neil Cerutti <ne...@norwich.edu> wrote:
>>> > In the real-world telco benchmark for _decimal, replacing the
>>> > single line
>>> >
>>> >     outfil.write("%s\n" % t)
>>> >
>>> > with
>>> >
>>> >     outfil.write("{}\n".format(t))
>>> >
>>> > adds 23% to the runtime. I think %-style formatting should not
>>> > be deprecated at all.
>>>    
>>> When it becomes necessary, it's possible to optimize it by
>>> hoisting out the name lookups.
>>>    ...
>>>    outfil_write = outfil.write
>>>    append_newline = "{}\n".format
>>>    ...
>>>        outfil_write(append_newline(t))
>>>        ...
>>
>> Did you profile this? I did, and it still adds 22% to the runtime.
>
> No, I did not. And that's disappointing.

On many levels. Thanks for the correction.

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to