Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much slower is a wxWidget written in Python versus C++?

I'm looking into writing a wxWidget that displays a graphical node network, and therefore does a lot of drawing operations. I know that using Python to do it is going to be slower, but I'd rather get it working and port it later when its functional. Ideally, if the performance hit isn't too great, I'd prefer to keep the codebase in Python for easy updates.

What I'm wondering is how much slower should I expect things to go? I realize this is vague and open ended, but I just need a sense of what to expect. Will drawing 500 circles bog down? Will it be noticeable at all? What are your experiences?

like image 764
Soviut Avatar asked Dec 18 '08 21:12

Soviut


2 Answers

IMHO, main bottleneck will be the data structures you are going to use for representing the network graph. I have coded a similar application for tracing dependencies between various component versions in a system and graphics was the last thing I had to worry about and I was certainly drawing more than 500 objects with gradient fills for some of them!

If you are getting bogged down, you should checkout using PyGame for drawing things.

like image 172
Suraj Avatar answered Oct 17 '22 17:10

Suraj


In my experience, doing things the naive way (drawing each object to the screen) will bog down in Python quicker than C++. However, with Python it's going to be a lot quicker and less painful to code it the clever way (see for example PseudoDC), which will blow the naive C++ implementation out of the water.

I agree with suraj. above that PyGame may be a good choice, depending on how graphics-intensive the app is, compared to the convenient wxPython stuff you'll be giving up.

like image 30
Ryan Ginstrom Avatar answered Oct 17 '22 18:10

Ryan Ginstrom