This has the potential to speed up simple strings expressions like
s = '1' + '2' + '3' + '4' + '5' + '6' + '7' + '8'
However, if this is followed by
s += '9' this (the 9th string) will cause rendering of the existing value of s and then create another concatenated string. This can, however, be changed, but I have not checked to see if it is worth it.
The deallocation code needs to be robust for a complex tree - it is currently not recursive, but needs to be, like the concatenation code.
Construct like s = a + b + c + d + e , where a, b etc. have been assigned string values earlier will not benefit from the patch.
If the values are generated and concatenated in a single _expression_, that is another type of construct that will benefit.
There are some other changes needed that I can write up if needed.
-Chetan
On 10/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]
> wrote:
Date: Fri, 13 Oct 2006 12:02:06 -0700
From: Josiah Carlson < [EMAIL PROTECTED]>
Subject: Re: [Python-Dev] PATCH submitted: Speed up + for string
concatenation, now as fast as "".join(x) idiom
To: Larry Hastings < [EMAIL PROTECTED]>, [email protected]
Message-ID: <[EMAIL PROTECTED] >
Content-Type: text/plain; charset="US-ASCII"
Larry Hastings <[EMAIL PROTECTED]> wrote:
[snip]
> The machine is dual-core, and was quiescent at the time. XP's scheduler
> is hopefully good enough to just leave the process running on one core.
It's not. Go into the task manager (accessable via Ctrl+Alt+Del by
default) and change the process' affinity to the second core. In my
experience, running on the second core (in both 2k and XP) tends to
produce slightly faster results. Linux tends to keep processes on a
single core for a few seconds at a time.
- Josiah
_______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
