PDA

View Full Version : PyQt performance



solartic
3rd July 2010, 01:47
Hi guys

I'm considering developing a simple web-browser but im wondering if i should use PyQt or c++
I have more c++ experience but going python seem like it would save me a lot more time.

I was juts wondering if their are are any significant speed gain in using c++ over python

Talei
3rd July 2010, 02:12
Look here: http://shootout.alioth.debian.org/ so in general C++ is faster. Said that there are task that are done faster in Python. So basically it's all depends on other question: do You want spend more time developing and learn more about Python or code it faster?
Some time ago I stumble upon a problem with parsing HTML. I did it in PHP and due to "friendly" function this task was easy, then I had the same problem with Qt/C++ and after some research I must say that complexity is the same, just functions changes. Ofcourse higher level languages make it simpler but still I think You will manage to do it in C++/Qt fairly easy (QTcpSocket, QWebkit, QNetworkManager, QCookie, etc... there are ready components).
Keep in mind that You will work with the same framework, so code is pretty much similar between Python and C++ in that case.

solartic
3rd July 2010, 02:54
Thanks for the reply and and that very useful link.

You want spend more time developing and learn more about Python or code it faster?
Well both i recently started web development using django/python so i do want to learn more about python as a language and i intend to regardless of what I chose for this project
Im not really worried about complexity, but after looking at some qt tutorials with exact apps done in both python and c++ the code length in python is almost 1/2 that of the c++ ones.
Maybe starting with c++ is a good choice still, especial since Im not really sure if ill need the extra power eventually considering i do go through with this project.

Talei
3rd July 2010, 13:32
I would disagree about code length. Recently I did MVC in python (with spinbox/checkbox on the view witch delegates etc..) and code length was pretty much the same to the one in C++ (I used in that code 95% Qt code). But, as always, this all depends on the task that program performs. As said before, higher level languages offers more "programmer friendly functions" so the relatively "complex task" can be done with less code.
I want also point out here, that making Your own web browser is really easy with Qt. Basically use QTcpSocket for communication (or QNetworkAccessManager/ QNetworkReply/ QUrl / QNetworkRequest / QNetworkCookie), retrieve data and send it to the QWebKit. That's practically all what You need to do to make simple web browser. Of course this is a simplification, but bottom line here is that in this project language usage, or language speed, is really the last thing to worries about. (assuming that You will actually use QtNetwork modules)
Regards

agathiyaa
3rd July 2010, 20:33
hi solartic,

If you are comfortable with C++ use Qt/C++
if you are comfortable/like python use PyQt.

Dont Worry about performance. You cannot see much performance difference between PyQt and Qt/C++ in realtime. You may create C based DLL's for performance intensive code and import them into your python script(Python Extensions). C/C++ is fastest. Python can use C/C++ speed. But Python is simpler than C/C++.

solartic
4th July 2010, 05:51
Thanks for the help guys think ill be going with python