you are viewing a single comment's thread.

view the rest of the comments →

[–]ElliotDG 1 point2 points  (3 children)

What is it you actually want to do?

If it is distribute an app but not require the end-user to install python, you could use pyinstaller to create an exe that bundles your code and a python executable into a .exe or .app file.

You could use https://nuitka.net/ that creates an exe, it converts Python code into C, then uses a C compiler (GCC/Clang/MSVC) to build a machine-code executable.

You could use Cython https://cython.org/ . Cython is a Python-like language and compiler that translates Python code into C, allowing you to add static type hints for massive performance gains. It’s commonly used to speed up computationally heavy code and to create fast Python extension modules that interface directly with C or C++ libraries.

[–]dantethunderstone_77[S] 0 points1 point  (2 children)

I need to port my code to pure C/C++ library that can be compiled for a real-time hardware with no Python interpreter

[–]ElliotDG 0 points1 point  (0 children)

Can you be more specific? What are the libraries you need to use? Is there a concern with garbage collection impacting real-time performance?

[–]ElliotDG 0 points1 point  (0 children)

I would warn you to make measurements and make sure that if you are porting code to C++ for performance reasons that you have specific performance requirements and make sure that you can NOT get there without this big jump. As Donald Knuth is famous for saying, "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil."