list addition methods compared.

Fran=?ISO-8859-1?B?5w==?=ois Granger fgranger at fgranger.com
Mon Dec 27 18:49:14 CET 2004


Le 27/12/04 1:03, « Ishwor » <ishwor.gurung at gmail.com> a écrit :

> so indeed method 2 (l2.extend() ) is the fastest ?? In 2/3 times,
> method 3 (l3 += [x] seems faster than method 1/2 in my P2.4GHZ machine
> with 512mb??? :-(
> Could u run the code in your machine and perhaps and let me know what
> the average speed is??

On a iBook G4 à 1.2 Ghz loaded with tons of other softwares running.


fgranger:/develop/python scripts fgranger$ python listspeed.py
@@@@@@@
Method 1 done in (average finish time(out of 3)) - 5.6365475655
Method 2 done in (average finish time(out of 3)) - 0.0562076569
Method 3 done in (average finish time(out of 3)) - 0.0455052853
@@@@@@@
fgranger:/develop/python scripts fgranger$ python listspeed.py
@@@@@@@
Method 1 done in (average finish time(out of 3)) - 6.1534483433
Method 2 done in (average finish time(out of 3)) - 0.0637686253
Method 3 done in (average finish time(out of 3)) - 0.0500767231
@@@@@@@
fgranger:/develop/python scripts fgranger$ python listspeed.py
@@@@@@@
Method 1 done in (average finish time(out of 3)) - 5.5850391388
Method 2 done in (average finish time(out of 3)) - 0.0594174862
Method 3 done in (average finish time(out of 3)) - 0.0549054146
@@@@@@@


-- 
François Granger
 fgranger at fgranger.com
+ 33 6 61 36 96 17 (mobile)
+ 33 1 47 35 00 16 (home)





More information about the Python-list mailing list