speeding up string.split()
Chris Green
cmg at uab.edu
Thu May 24 18:10:55 EDT 2001
Is there any way to speed up the following code? Speed doesn't matter
terribly much to me but this seems to be a fair example of what I need
to do.
In the real data, I will be able to have a large array and use
map rather than do it line by line but, I doubt this will change
things much for the better.
I've tried w/ python 2 and 1.5.2 and the differences between perl and
python remain huge ( about 5s:1s python:perl ).
The string is +'d together for usenet purposes
#!/usr/bin/python
from string import split
for i in range(300000):
array = split('xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy 6' +
'1064 80 54 54 1 1 14:00:00.8094 14:00:00.8908 1 2')
#!/usr/bin/perl
for (0..300000) {
@array = split('xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy 6' .
'1064 80 54 54 1 1 14:00:00.8094 14:00:00.8908 1 2');
}
--
Chris Green <cmg at uab.edu>
This is my signature. There are many like it but this one is mine.
More information about the Python-list
mailing list