On Fri, May 18, 2012 at 12:58 AM, Sasikanth Eda <[email protected]>wrote:
> Hai All,
>
> In trails of finding the execution time lapse between Python and PyPy ,
> its proved that PyPy is slower than Python.
>
> Here are the trials done ;
>
> *Step-1: Written a Python code that uses repeated os.rename()*
> *
> *
> *code: (file name : rename.py)*
> * #!/usr/bin/env python*
> *
> *
> * import os*
> * import sys*
> *
> *
> * os.chdir("/opt/pypy-1.8/bin")*
> * print "Rename count -1 (a1 -> a2)"*
> * os.rename("a1","a2")*
> * print "Rename count -2 (a2 -> a3)"*
> * os.rename("a2","a3")*
> * print "Rename count -3 (a3 -> a4)"*
> * os.rename("a3","a4")*
> * print "Rename count -4 (a4 -> a5)"*
> * os.rename("a4","a5")*
> * print "Rename count -5 (a5 -> a6)"*
> * os.rename("a5","a6")*
> * print "Rename count -6 (a6 -> a7)"*
> * os.rename("a6","a7")*
> * print "Rename count -7 (a7 -> a8)"*
> * os.rename("a7","a8")*
> * print "Rename count -8 (a8 -> a9)"*
> * os.rename("a8","a9")*
> * print "Rename count -9 (a9 -> a0)"*
> * os.rename("a9","a0")*
> * print "Rename count -10 (a0 -> B0)"*
> * os.rename("a0","B0")*
> *
> *
> *Step-2: Observed Execution time with Python 2.7*
> *
> *
> * [root@Manojkiran bin]# time python rename.py *
> * Rename count -1 (a1 -> a2)*
> * Rename count -2 (a2 -> a3)*
> * Rename count -3 (a3 -> a4)*
> * Rename count -4 (a4 -> a5)*
> * Rename count -5 (a5 -> a6)*
> * Rename count -6 (a6 -> a7)*
> * Rename count -7 (a7 -> a8)*
> * Rename count -8 (a8 -> a9)*
> * Rename count -9 (a9 -> a0)*
> * Rename count -10 (a0 -> B0)*
> *
> *
> * real 0m0.031s*
> * user 0m0.021s*
> * sys 0m0.010s*
>
> Step-3:* Observed Execution time with PyPy 1.8*
> *
> *
> [root@Manojkiran bin]# time ./pypy rename.py
> * ./pypy: /usr/local/ssl/lib/libssl.so.0.9.8: no version
> information available (required by ./pypy)*
> * ./pypy: /usr/local/ssl/lib/libcrypto.so.0.9.8: no version
> information available (required by ./pypy)*
> * Rename count -1 (a1 -> a2)*
> * Rename count -2 (a2 -> a3)*
> * Rename count -3 (a3 -> a4)*
> * Rename count -4 (a4 -> a5)*
> * Rename count -5 (a5 -> a6)*
> * Rename count -6 (a6 -> a7)*
> * Rename count -7 (a7 -> a8)*
> * Rename count -8 (a8 -> a9)*
> * Rename count -9 (a9 -> a0)*
> * Rename count -10 (a0 -> B0)*
>
> real 0m0.054s
> user 0m0.036s
> sys 0m0.016s
> *
> *
> *Step-4: Written a Python code that uses repeated os.link()*
> *
> *
> *code: (file name : link.py)*
> * #!/usr/bin/env python*
> *
> *
> * import os*
> * import sys*
> *
> *
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l0")*
> * print "Linked count -1 (l0 -> lo)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l1")*
> * print "Linked count -2 (l0 -> l1)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l2")*
> * print "Linked count -3 (l0 -> l2)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l3")*
> * print "Linked count -4 (l0 -> l3)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l4")*
> * print "Linked count -5 (l0 -> l4)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l5")*
> * print "Linked count -6 (l0 -> l5)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l6")*
> * print "Linked count -7 (l0 -> l6)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l7")*
> * print "Linked count -8 (l0 -> l7)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l8")*
> * print "Linked count -9 (l0 -> l8)"*
> * os.link("/opt/pypy-1.8/bin/l0","/opt/pypy-1.8/bin/test/l9")*
> * print "Linked count -10 (l0 -> l9)"*
>
> *Step-5: Observed Execution time with Python 2.7*
> *
> *
> * [root@Manojkiran bin]# time python link.py *
> * Linked count -1 (l0 -> l0)*
> * **Linked** count -2 (l0 -> l1)*
> * **Linked** count -3 (l0 -> l2)*
> * **Linked** count -4 (l0 -> l3)*
> * **Linked** count -5 (l0 -> l4)*
> * **Linked** count -6 (l0 -> l5)*
> * **Linked** count -7 (l0 -> l6)*
> * **Linked** count -8 (l0 -> l7)*
> * **Linked** count -9 (l0 -> l8)*
> * **Linked** count -10 (l0 -> l9)*
> *
> *
> * real 0m0.028s*
> * user 0m0.020s*
> * sys 0m0.008s*
>
> Step-6:* Observed Execution time with PyPy 1.8*
> *
> *
> [root@Manojkiran bin]# time ./pypy link.py
> * ./pypy: /usr/local/ssl/lib/libssl.so.0.9.8: no version
> information available (required by ./pypy)*
> * ./pypy: /usr/local/ssl/lib/libcrypto.so.0.9.8: no version
> information available (required by ./pypy)*
> * Linked count -1 (l0 -> l0)*
> * **Linked** count -2 (l0 -> l1)*
> * **Linked** count -3 (l0 -> l2)*
> * **Linked** count -4 (l0 -> l3)*
> * **Linked** count -5 (l0 -> l4)*
> * **Linked** count -6 (l0 -> l5)*
> * **Linked** count -7 (l0 -> l6)*
> * **Linked** count -8 (l0 -> l7)*
> * **Linked** count -9 (l0 -> l8)*
> * **Linked** count -10 (l0 -> l9)*
> *
> *
> real 0m0.056s
> user 0m0.032s
> sys 0m0.023s
>
> Hence in my understanding Python is better in terms of execution time when
> compared with PyPy.
>
> Kindly suggest me if my trails are proper and why PyPy failed to achieve
> better speed then PyPy ?
>
> Is this a know issue or whether we have any fix for this ?
>
> Thanking you,
> --
> Sasikanth
>
>
>
>
> _______________________________________________
> pypy-dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/pypy-dev
>
>
PyPy's JIT works by optimizing loops and functions that are frequently run,
this generally means your code needs to run at least .5 seconds for the JIT
to kick in and show benefits. Your code contains no loops for the JIT to
optimize.
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev