nuitka binaries slow performance with Python3 in-place string add
See original GitHub issueNuitka version:
0.6.0rc4
Python: 3.6.6 (default, Sep 12 2018, 18:26:19)
Executable: /usr/bin/python3
OS: Linux
Arch: x86_64
Installed via: apt
Greetings,
Really love this project. Thanks for all your hard work on it. My nuitka binaries generally perform really well, even for complex projects. The one exception is when I implement code that generates a large volume of random numbers. The code below is much slower in a nuitka build when compared to running it in the python3 interpreter:
chars = []
for i in range(256):
chars += [chr(i)]
wrapper = ""
for i in range(10000000):
wrapper += random.choice(chars)
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
Nuitka: An extremely compatible Python compiler - Hacker News
It's slower than pypy, but starts faster and results in a standalone executable. Also, it's compatible with most c extensions.
Read more >Nuitka-fixed - PyPI
Nuitka is the Python compiler. It is written in Python. It is a seamless replacement or extension to the Python interpreter and compiles...
Read more >Nuitka - Gitee
Nuitka is a Python compiler written in Python. ... and this even happens to the DLL with itself, being slower, than a Python...
Read more >Programming FAQ — Python 3.11.1 documentation
Performance. My program is too slow. How do I speed it up? What is the most efficient way to concatenate many strings together?...
Read more >Compiling Python Code to Executable with nuitka
Avoid running the nuitka binary, doing python -m nuitka will make a 100% sure you are using what you think you are. Using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you again! I can see how creating strings (which are immutable in python) would be a waste. I re-factored the code to use lists rather than strings, with a final
.join()
at the end, and it is indeed much faster in nuitka. It now looks like this:This has long been resolved by recent changes that avoid the CPython API for in-place operations on these types. In Nuitka 0.6.13 this should no longer happen.