[pypy-dev] PyPy proved slower than Python when used os.rename and os.link [ Suggest how to get rid of this ]
Sasikanth Eda
sasikanth.ece at gmail.com
Fri May 18 06:58:11 CEST 2012
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 at 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 at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120518/6626f986/attachment.html>
More information about the pypy-dev
mailing list