How much slower is wxWidget written in Python compared to C ++?

I am writing a wxWidget that displays the node graphic network and therefore performs many drawing operations. I know that using Python for this will be slower, but I would prefer it to work, and later its port when it works. Ideally, if the performance is not too great, I would prefer to keep the Python code base for easy updating.

What interests me is how much slower should I expect everything to be? I understand that this is vague and open, but I just need to understand what to expect. Will 500 circles loom? Will it be noticeable? What are your impressions?

+6
c ++ performance python wxpython drawing
source share
3 answers

IMHO, the main bottleneck will be the data structures that you are going to use to represent the network. I coded a similar application to track dependencies between different versions of components in the system, and graphics was the last thing I had to worry about, and I definitely collected over 500 objects with gradient fillings for some of them!

If you're bogged down, you should check using PyGame to draw things.

+1
source share

In my experience, doing things in a naive way (pulling every object onto the screen), it will fall in Python faster than C ++. However, with Python, it will be much faster and less painful to encode it in a smart way (see, for example, PseudoDC ), which will hit a naive C ++ implementation from the water.

I agree with suraj. above that PyGame may be a good choice, depending on how graphically the application works, compared to the convenient wxPython material that you will hand over.

+1
source share

People suggested PyGame for drawing. I like PyGame, its easy to work and works well. Other options might be a Pyglet or using PyOpenGL (you will most likely draw a wx widget as well, although I have never done so).

Personally, I would do it in Python using any library that I am most familiar with (in my case, I would use pygtk and cairo) and worry about performance only when it becomes a problem - then profile and optimization is a bottleneck if it Python code is slow, I will know which bits will be executed in C. Instead.

+1
source share

All Articles