Drastic performance issue (Binaries execution slower than Python!)
See original GitHub issue0.6.14.4 Python: 3.5.3 (default, Nov 18 2020, 21:09:16) OS: Linux Arch: x86_64 Installed via Pip in a virtualenv.
Hallo, I am using nuitka as everybody here in order to transpile python script into binaries file and thus expect to be a bit faster than in Python. It is, normally, but I am facing right now a big issue. I developped a server containing three threads (threading module from Python) : -one for recieving messages from client via a socket and answer him -one for sending in real time events to the client. -and one, the main thread containing the two above. It controlls in a try catch, if the flag of the receiver thread is set to True (means that it received an empty string) and thus restart the server, or catch a Keyboard exception and shutdown everything.
I used this command to generate the distribution : python -m nuitka --standalone --show-progress main.py My program use many natif Python modules such as socket, threading, ElementTree, etc… and use also Redis module (https://pypi.org/project/redis/) And what is really strange is that the binary program is slowed down! It takes an incredible amount of time to do for loops. For example, this little piece of code is a bottleneck :
for device in data.db2.lrange("historique",0,-1):
if data.db2.exists(device) == 0:
data.db2.lrem("historique",0,device)
db2 is a Redis databe ; lrem return components from list in given range here 0 to -1. This piece of code is executed in a blink in Python. And as far as I know, I dont think the problem is from Redis because I already transpiled monothread program using Redis commands without any performance issues.
So the question, why the binaries are slow? Does nuitka supports multi threading? What are the things to avoid while programming in Python in order to have the most optimized binary compilation? Best Regards
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
It would be nice, if someone packaged this as a test case, testing support for redis would be nice.
Not sure, closing for lack of feedback, the original issue seems resolved and if you need help to provide it as a test case, that’s how far we can get, as I cannot help you do that.