[Pyrex] Speeding up custom string lowercasing with Pyrex
Bob Van Zant
bob at norcalttora.com
Wed Oct 31 15:04:13 CET 2007
The += part was fixed up? Or the "".join() was made even faster?
-Bob
On 10/31/07 7:27 PM, "skip at pobox.com" <skip at pobox.com> wrote:
>
> Bob> The "to = to + c" line strikes me as not being efficient. Python
> Bob> creates a new copy of "to" every time it appends "c" to the
> Bob> end. One common, pure-python fix is:
>
> Bob> to = []
> Bob> for ...
> Bob> ...
> Bob> to.append( c )
> Bob> return "".join(to)
>
> This common case was sped up in Python 2.5.
>
> Skip
>
More information about the Pyrex
mailing list