Message169812
| Author |
eng793 |
| Recipients |
eng793, r.david.murray, rhettinger, serhiy.storchaka |
| Date |
2012年09月03日.22:55:55 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1346712956.3.0.326893344799.issue15837@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The int=int still makes no difference, but if the second argument is set to random.random, we get a big speedup, regardless of whether the third argument is there:
without int=int:
amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst,random.random); print (len(lst))"
1000000
real 0m7.082s
user 0m6.952s
sys 0m0.116s
With int=int:
amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst,random.random); print (len(lst))"
1000000
real 0m7.281s
user 0m7.156s
sys 0m0.100s
Without second argument:
amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst); print (len(lst))"
1000000
real 0m13.783s
user 0m13.609s
sys 0m0.108s
This could be because of the many tests of whether the 2nd argument is None in the loop. |
|