LISTS: Extract every other element - SUMMARY
Randall Hopper
aa8vb at yahoo.com
Fri Dec 17 13:48:26 EST 1999
Adrian Eyre:
|> I coded each of these up, working with the same list of 100,000
|> integers. Here are the results.
|>
|> [snip]
|
|Did you try them all with the -O option?
No, these were without -O. -O betters the times around 4-5%. Relative
performance rankings stay the same though.
> python odd_elements.py
APPROACH #1 : 100.00% (2.07391 sec)
APPROACH #1b: 96.95% (2.01062 sec)
APPROACH #2 : 697.01% (14.4554 sec)
APPROACH #3 : 122.20% (2.53422 sec)
APPROACH #4 : 315.16% (6.53619 sec)
APPROACH #4b: 719.41% (14.92 sec)
APPROACH #5 : 109.06% (2.26185 sec)
APPROACH #6 : 68.83% (1.42751 sec)
> python -O odd_elements.py
APPROACH #1 : 100.00% (1.96201 sec)
APPROACH #1b: 97.42% (1.91136 sec)
APPROACH #2 : 711.30% (13.9558 sec)
APPROACH #3 : 125.33% (2.45899 sec)
APPROACH #4 : 306.96% (6.02248 sec)
APPROACH #4b: 731.77% (14.3575 sec)
APPROACH #5 : 115.87% (2.27329 sec)
APPROACH #6 : 71.37% (1.40032 sec)
--
Randall Hopper
aa8vb at yahoo.com
More information about the Python-list
mailing list