Profiling of wxApp shows XRC a real hog

Hi,

I've been toying with the hotshot profiler lately, and looking at the 3 most
expensive calls in my wxApp, reveals that XRC is a real resource hog:

20802 function calls (20567 primitive calls) in 9.110 CPU seconds

   Ordered by: internal time, call count
   List reduced from 851 to 40 due to restriction <40>

   ncalls tottime percall cumtime percall filename:lineno(function)
        3 5.709 1.903 5.745 1.915 xrc.py:75(__init__)
        7 0.779 0.111 0.779 0.111 xrc.py:139(LoadPanel)
        4 0.198 0.050 0.198 0.050 _gdi.py:6097(GetFont)
      23 0.191 0.008 0.191 0.008 _gdi.py:515(__init__)
    209 0.085 0.000 0.086 0.000 _controls.py:4519(SetStringItem)
        2 0.079 0.039 0.079 0.040 _core.py:8841(Show)

As you can see, the startup was over 9 seconds (!) - normally it only takes
3-4, but occationally it takes as long as the profile above indicates. I
don't want to drop using XRC, as I like wysiwyg for GUI editing. But is there
anything I could try to increase the performance?

Can I for example generate pure python code from XRC, without relying on the
xml?

Hi,

Hi,

[…]

Can I for example generate pure python code from XRC, without relying on the

xml?

_

Perhaps you can try wxGlade. It can import XRC files, it generated python code, it’s a almost-wysiwyg GUI editor.
I don’t know what tool you use to create XRC files, so I don’t know how wxGlade fares compared to that tool as a GUI editor or for supported widgets, but it’s worth looking at.

Cheers,

–Tim

···

On Tue, Apr 22, 2008 at 10:53 AM, Frank Aune Frank.Aune@broadpark.no wrote:


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Gre7g Luterman wrote:

···

On 4/22/08, *Frank Aune* <Frank.Aune@broadpark.no > <mailto:Frank.Aune@broadpark.no>> wrote:

    Can I for example generate pure python code from XRC, without
    relying on the
    xml?

The free XRC editor that comes with wxPython, XRCed, has a "Generate Python..." option in the File menu.

But it's still using the XRC xml from a set of stub classes that are generated, so it would still have the same performance issues. On the other hand, I don't expect that generating full XML-less Python code from XRC would be too difficult. If somebody wanted to try adding that ability to the pywxrc tool then I would look at including it with wxPython.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

This doesn't match my experience with the performance of XRC, either
in Python or in C++. I'd suggest trying to do some more detailed
profiling and finding out exactly why your __init__ is taking that
long. How big is your XRC xml file?

···

On Tue, Apr 22, 2008 at 5:18 PM, Robin Dunn <robin@alldunn.com> wrote:

Gre7g Luterman wrote:

> On 4/22/08, *Frank Aune* <Frank.Aune@broadpark.no > <mailto:Frank.Aune@broadpark.no>> wrote:
>
> Can I for example generate pure python code from XRC, without
> relying on the
> xml?
>
> The free XRC editor that comes with wxPython, XRCed, has a "Generate
Python..." option in the File menu.
>

But it's still using the XRC xml from a set of stub classes that are
generated, so it would still have the same performance issues. On the other
hand, I don't expect that generating full XML-less Python code from XRC
would be too difficult. If somebody wanted to try adding that ability to
the pywxrc tool then I would look at including it with wxPython.

--