Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is compiled python code as fast as C++ code?

if i write a program in Python and then compile it using any of these compilers:

Gordon McMillan’s installer (cross-platform)

Thomas Heller’s py2exe

(Windows) Anthony Tuininga’s cx_Freeze (cross-platform)

is it as fast as code written in a compiled language?

like image 356
tarrasch Avatar asked Sep 22 '26 04:09

tarrasch


2 Answers

These tools are not compilers, they're just packaging python code into an easier to launch application. If you want something more like compilation try http://pypy.org (JIT for python) or http://code.google.com/p/shedskin (which translates Python to C++).

like image 135
Alexandre Hamez Avatar answered Sep 25 '26 03:09

Alexandre Hamez


For speed, you may also want to look into Cython that allows writing C extensions for Python in a Python-like language.

like image 41
setrofim Avatar answered Sep 25 '26 02:09

setrofim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!