python/dist/src/Doc/tut tut.tex,1.225,1.226
Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24443 Modified Files: tut.tex Log Message: Update timeit example to reflect current performance. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** tut.tex 21 Mar 2004 22:12:45 -0000 1.225 --- tut.tex 26 Mar 2004 07:56:23 -0000 1.226 *************** *** 4635,4646 **** feature instead of the traditional approach to swapping arguments. The \ulink{\module{timeit}}{../lib/module-timeit.html} module ! quickly demonstrates that the traditional approach is faster: \begin{verbatim}
from timeit import Timer Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() ! 0.60864915603680925 Timer('a,b = b,a', 'a=1; b=2').timeit() ! 0.8625194857439773 \end{verbatim}
--- 4635,4646 ---- feature instead of the traditional approach to swapping arguments. The \ulink{\module{timeit}}{../lib/module-timeit.html} module ! quickly demonstrates a modest performance advantage: \begin{verbatim}
from timeit import Timer Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() ! 0.57535828626024577 Timer('a,b = b,a', 'a=1; b=2').timeit() ! 0.54962537085770791 \end{verbatim}
participants (1)
-
rhettingerīŧ users.sourceforge.net