Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wxPython performance

1 view
Skip to first unread message

Andrei Kulakov

unread,
Jun 1, 2002, 10:38:46 AM6/1/02
to
Hello,

"hello world" type program from wxPython tutorial takes 6
seconds to start on my cel 366 128mb system (running Debian). Is
this typical? Why is it so slow? I'm looking for a graphic
toolkit that'd be fairly quick. I don't want to use Tk because of
the looks.

- Andrei

--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org

Peter Hansen

unread,
Jun 1, 2002, 11:08:50 AM6/1/02
to
Andrei Kulakov wrote:
>
> Hello,
>
> "hello world" type program from wxPython tutorial takes 6
> seconds to start on my cel 366 128mb system (running Debian). Is
> this typical? Why is it so slow? I'm looking for a graphic
> toolkit that'd be fairly quick. I don't want to use Tk because of
> the looks.

How fast do you need it to be? (That's a serious question.
Are you planning to open and close the application so frequently
that six seconds is unacceptable?)

On my blazing 233 MHz Windows 98 machine, with Python 2.2.1
and WxPython 2.3.2.1, a hello world program I just wrote
runs in about two seconds, for what it's worth.

-Peter

Andrei Kulakov

unread,
Jun 1, 2002, 12:25:51 PM6/1/02
to
In article <3CF8E382...@engcorp.com>, Peter Hansen wrote:
> Andrei Kulakov wrote:
>>
>> Hello,
>>
>> "hello world" type program from wxPython tutorial takes 6
>> seconds to start on my cel 366 128mb system (running Debian). Is
>> this typical? Why is it so slow? I'm looking for a graphic
>> toolkit that'd be fairly quick. I don't want to use Tk because of
>> the looks.
>
> How fast do you need it to be? (That's a serious question.
> Are you planning to open and close the application so frequently
> that six seconds is unacceptable?)
>
For me it's not a big deal, but I plan to write apps for
other people, and this 6 seconds just feels wrong. I guess it's
more of a psychological thing than anything else.. Anyway, it's
still not that big a deal, I was just hoping someone would say
"of course, you have to use this flag or option:
--start-in-one-second" or "pygtk will start in 2 sec". If
everythign is this slow, I'll just use wxPython and won't mind it
too much :-).

>
> On my blazing 233 MHz Windows 98 machine, with Python 2.2.1
> and WxPython 2.3.2.1, a hello world program I just wrote
> runs in about two seconds, for what it's worth.
>
> -Peter

Odd.. if not too much trouble, could you please try this one
(from wxpython tutorial)?

from wxPython.wx import *

class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true

app = MyApp(0)
app.MainLoop()

Peter Hansen

unread,
Jun 1, 2002, 2:03:45 PM6/1/02
to
Andrei Kulakov wrote:
>
> > On my blazing 233 MHz Windows 98 machine, with Python 2.2.1
> > and WxPython 2.3.2.1, a hello world program I just wrote
> > runs in about two seconds, for what it's worth.
> >
> > -Peter
>
> Odd.. if not too much trouble, could you please try this one
> (from wxpython tutorial)?
>
[snip short hello world]

First time running: 4 seconds.

Subsequent invocations: 2 seconds.

-Peter

Chris Liechti

unread,
Jun 1, 2002, 3:54:18 PM6/1/02
to
Andrei Kulakov <a...@silmarill.org> wrote in
news:slrnafht...@ak.silmarill.org:

> In article <3CF8E382...@engcorp.com>, Peter Hansen wrote:
>> Andrei Kulakov wrote:
>>>
>>> "hello world" type program from wxPython tutorial takes 6
>>> seconds to start on my cel 366 128mb system (running Debian). Is
...

> . if not too much trouble, could you please try this one
> (from wxpython tutorial)?
>
> from wxPython.wx import *
>
> class MyApp(wxApp):
> def OnInit(self):
> frame = wxFrame(NULL, -1, "Hello from wxPython")
> frame.Show(true)
> self.SetTopWindow(frame)
> return true

i changed this to "return false"

> app = MyApp(0)
> app.MainLoop()

(2nd time, P3-600 Win32)

$ time python news_wxspeedtest.py
OnInit returned FALSE, exiting...
...
real 0m1.382s
user 0m0.020s
sys 0m0.030s

here the slowest part is loading and initilaizing the interpreter.
i think wx windows slows loading down, especialy the first time, because
its loading the wx library. on win32 this is about 4MB.

chris

--
Chris <clie...@gmx.net>

Kragen Sitaker

unread,
Jun 1, 2002, 4:08:55 PM6/1/02
to
Peter Hansen <pe...@engcorp.com> writes:
> How fast do you need it to be? (That's a serious question.
> Are you planning to open and close the application so frequently
> that six seconds is unacceptable?)

From a human interface perspective, having to wait six seconds for a
response to a command (including "start program") is annoying; this is
the reason for "splash screens". You don't want people to be annoyed
every time they start your program.

Worse, six seconds is plenty of time for a user's thoughts to wander;
it means that the user may have forgotten what they wanted to do by
the time the program starts.

Peter Hansen

unread,
Jun 1, 2002, 5:45:50 PM6/1/02
to
Kragen Sitaker wrote:
>
> Peter Hansen <pe...@engcorp.com> writes:
> > How fast do you need it to be? (That's a serious question.
> > Are you planning to open and close the application so frequently
> > that six seconds is unacceptable?)
>
> From a human interface perspective, having to wait six seconds for a
> response to a command (including "start program") is annoying; this is
> the reason for "splash screens". You don't want people to be annoyed
> every time they start your program.

I realize that. That's why I was directing the discussion towards
alternatives, such as splash screens... :-)

Other options might include making sure modules are not loaded
until they are needed, or loading them on a separate thread just
after the main program starts.

None of which seems to help the OP. I'm curious why the Linux
implementation is so much slower than the Win32. My own machine
is _not_ fast! (It's only a 233 MHz Pentium MMX.)

-Peter

Boudewijn Rempt

unread,
Jun 1, 2002, 6:36:47 PM6/1/02
to
Peter Hansen wrote:
>
> Other options might include making sure modules are not loaded
> until they are needed, or loading them on a separate thread just
> after the main program starts.
>

Convincing your users that they need to preload the libs might
work too -- for instance by creating a 'server' component that
should be started when the machine is booted that loads the lib.

> None of which seems to help the OP. I'm curious why the Linux
> implementation is so much slower than the Win32. My own machine
> is _not_ fast! (It's only a 233 MHz Pentium MMX.)
>

wxPython has to load gtk, probably, and the bindings. The underlying
gui library is already present in memory on a windows machine, leaving
only the bindings to be loaded.

I've also noticed that Python loads its own bytecode files rather
more slowly than other files. So any pixmaps shouldn't be put in the
code, but loaded separately. That can make quite a difference.

--
Boudewijn Rempt | http://www.valdyas.org

Uwe Schmitt

unread,
Jun 1, 2002, 7:31:28 PM6/1/02
to
Andrei Kulakov <a...@silmarill.org> wrote:
| Hello,

| "hello world" type program from wxPython tutorial takes 6
| seconds to start on my cel 366 128mb system (running Debian). Is
| this typical? Why is it so slow? I'm looking for a graphic
| toolkit that'd be fairly quick. I don't want to use Tk because of
| the looks.

I had the same problem which appeared when I used py2exe.
The generated exe just neads one second instead of four...

Greetings, Uwe.


--

Dr. rer. nat. Uwe Schmitt ICQ# 159647634 Uwe.S...@num.uni-sb.de

Benno

unread,
Jun 1, 2002, 8:39:07 PM6/1/02
to
Andrei Kulakov <a...@silmarill.org> wrote in message news:<slrnafhm...@ak.silmarill.org>...

> Hello,
>
> "hello world" type program from wxPython tutorial takes 6
> seconds to start on my cel 366 128mb system (running Debian). Is
> this typical? Why is it so slow? I'm looking for a graphic
> toolkit that'd be fairly quick. I don't want to use Tk because of
> the looks.

I was using wxPython for a while. The main advantage being that it was
going to be cross platform, however I found its speed too slow. (Not startup
speed, which is fairly irrelevant to me, but just general responsiveness.)
I'm not sure if this was just wxWindows itself or the python bindings.

I have started using pygtk <http://www.daa.com.au/~james/pygtk/> (easily
apt-getable). The only problem I've had with this is the lack of docs.
http://www.moeraki.com/pygtktutorial/gtk-tut.html, seems to be the best
available, followed by reading the source.

Cheers,

Benno

Andrei Kulakov

unread,
Jun 1, 2002, 11:16:40 PM6/1/02
to
In article <3cf94ca7$0$31235$e4fe...@dreader1.news.xs4all.nl>,

Boudewijn Rempt wrote:
> Peter Hansen wrote:
>>
>> Other options might include making sure modules are not loaded
>> until they are needed, or loading them on a separate thread just
>> after the main program starts.
>>
>
> Convincing your users that they need to preload the libs might
> work too -- for instance by creating a 'server' component that
> should be started when the machine is booted that loads the lib.
>
>> None of which seems to help the OP. I'm curious why the Linux
>> implementation is so much slower than the Win32. My own machine
>> is _not_ fast! (It's only a 233 MHz Pentium MMX.)
>>
>
> wxPython has to load gtk, probably, and the bindings. The underlying
> gui library is already present in memory on a windows machine, leaving
> only the bindings to be loaded.
>
gtk-gnutella starts in 0.5 seconds on this system. I timed the
program I posted about, it takes 5.6s on first invocation, 4.7
and 4.6 on 2 subsequent ones.

>
> I've also noticed that Python loads its own bytecode files rather
> more slowly than other files. So any pixmaps shouldn't be put in the
> code, but loaded separately. That can make quite a difference.
>


--

Andrei Kulakov

unread,
Jun 1, 2002, 11:16:41 PM6/1/02
to

Thanks, I think that's exactly what I'm gonna have to do.

RPM1

unread,
Jun 2, 2002, 8:19:38 AM6/2/02
to

"Andrei Kulakov" <a...@silmarill.org> wrote

> Hello,
>
> "hello world" type program from wxPython tutorial takes 6
> seconds to start on my cel 366 128mb system (running Debian). Is
> this typical? Why is it so slow? I'm looking for a graphic
> toolkit that'd be fairly quick. I don't want to use Tk because of
> the looks.

I found wxPython to be slow also. I wrote a program to syntax
highlight a specific type of log file with Tkinter. I thought wxPython
would look better and it has more controls available so I ported it
to wxPython. The performance was so bad I went back to Tkinter.

For example, loading a 1MB file into the text box and syntax highlighting
it in Tkinter takes about 2 seconds. In wxPython it took more than
30 seconds.

Patrick M.

Mario Wehbrink

unread,
Jun 2, 2002, 6:19:33 PM6/2/02
to
Am Sat, 01 Jun 2002 14:38:46 GMT schrieb/wrote/
Andrei Kulakov < a...@silmarill.org > in comp.lang.python :

> Hello,
>
> "hello world" type program from wxPython tutorial takes 6
> seconds to start on my cel 366 128mb system (running Debian). Is
> this typical? Why is it so slow? I'm looking for a graphic
> toolkit that'd be fairly quick. I don't want to use Tk because of

Hi,

try pygtk. I also switched to it, after i found wxPython too slow for my
PPro-200.

http://www.daa.com.au/~james/pygtk/


Mario

--
http://www.porcupinetree.com

Eric Texier

unread,
Jun 5, 2002, 8:12:28 AM6/5/02
to
What did you lose using pygtk instead of wxWindow ?

Don Garrett

unread,
Jun 10, 2002, 12:12:10 PM6/10/02
to
RPM1 wrote:
> "Andrei Kulakov" <a...@silmarill.org> wrote
>
>>Hello,
>>
>> "hello world" type program from wxPython tutorial takes 6
>>seconds to start on my cel 366 128mb system (running Debian). Is
>>this typical? Why is it so slow? I'm looking for a graphic
>>toolkit that'd be fairly quick. I don't want to use Tk because of
>>the looks.

This whole thread is somewhat strange.... one of the things I liked about
wxWindows was that it seemed like one of the snappier cross plateform
libraries I've worked with. I'm on a relatively fast machine (1 Ghz with 512M)
with Windows (which has been mentioned here as having a faster start).

The first start up has touch of delay (less than most commercial apps), but
after that it's instant.

I guess it's hard to really remember just how much faster computers have
gotten over time.

--
Don Garrett http://www.bgb.cc/garrett/
BGB Consulting gar...@bgb.cc

Gerhard Häring

unread,
Jun 11, 2002, 1:49:46 AM6/11/02
to
* Don Garrett <gar...@bgb.cc> [2002-06-10 16:12 +0000]:

> RPM1 wrote:
> >"Andrei Kulakov" <a...@silmarill.org> wrote
> >> "hello world" type program from wxPython tutorial takes 6
> >>seconds to start on my cel 366 128mb system (running Debian). Is
> >>this typical? Why is it so slow? I'm looking for a graphic
> >>toolkit that'd be fairly quick. I don't want to use Tk because of
> >>the looks.
>
> This whole thread is somewhat strange.... one of the things I liked about
> wxWindows was that it seemed like one of the snappier cross plateform
> libraries I've worked with. [...]

I agree. Some people are mistaking "hello world" with typical
applications and startup time with performance ;-)

Gerhard
--
This sig powered by Python!
Außentemperatur in München: 12.1 °C Wind: 2.7 m/s


0 new messages