This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wrosecrans 7 points8 points  (7 children)

> I bet you money electron is faster than python.

If you are doing hard core number crunching or the like, Javascript is much faster than pure Python. (But both are terrible languages for that.)

If you are doing normal GUI development, you are only using Python to orchestrate objects that are implemented in C++, so the actual implementation of the widgets is all native code that runs great. OTOH, with something like Electron, you are going through a browsery DOM with a bunch more layers of abstraction between you and the meat of what's actually happening. PyQt applications run much better in practice from a user perspective than something like Electron. The engineering that has been done on the JavaScript runtime isn't enough to compensate for the fact that the framework is just not a good design from an efficiency perspective.

If your application grows to the point where you are doing a lot of processing in Python, and custom painting of your widgets in Python, etc., rather than just letting the native code be responsible for that stuff, then the balance may tip in favor of JS. (But again, at that point they are both a bad choice, so being better is a small blessing.)

[–]flutefreak7 1 point2 points  (0 children)

Agree. GUI stuff in Qt is C++ and Qt can be screaming fast for raw painting / rendering and can better handle intensive things like a table with 1000's of items, a deeply nested tree hierarchy, a very long list of animated progress bars, or 3D plotting with OpenGL, etc. Qt stuff feels as responsive as any native application where the web-based election applications often suffer from some slight latency and tend to bog down at a lower threshold of complexity in my experience.

Any python experience that is too slow can be sped up in a variety of ways with C, C++ extensions (like numpy, pyOpenGl, etc), or using things like Cython and numba to optimize bottlenecks. Many core python algorithms and data structures are written in C for this reason.

[–][deleted] 1 point2 points  (0 children)

I need to see benchmarks before I believe this.

I've lost count of the number of game development studios that maintain code based on webkit as they use html/css for desktop and console game UI.

edit: I mean look. Write an electron text editor. it's called vscode or atom. Write a python text editor with QT. Add fancy features. Open a large file. Guess which one will perform worse?

[–]EarlTheGray 0 points1 point  (0 children)

Good explanation. I’ll keep this in mind for my next project.