Help optimize a script?
Joseph Santaniello
joseph at arbitrary.org
Wed Oct 17 18:15:23 EDT 2001
On Wed, 17 Oct 2001 at 19:15, Terry Reedy wrote:
[snip]
>
> forms = {
> 'cob': lambda x: (strip(x[0:3], strip(x[3:9], ..., strip(x[22:30]),
> ...}
>
> (This conversion can be done with a fairly simple function.) Then,
> your program reduces to
>
> new = forms['cob']
> for line in file.xreadlines():
> print '\t'.join(new(line))
[snip]
Thanks Terry, that resulted in a 5x speed increase!
After compling 2.1.1 for HP-UX so I would have access to the join() method
of sting, I started to wonder how much of this speed increase (if any) is
from just using 2.1.1 over 1.5.2 ? Any ideas?
Joseph
More information about the Python-list
mailing list