IIRC, one change was how wxPython handles conversion of floating point
numbers to ints or longs before they are passed to the underlying
wxWidgets method. Depending on your input data, maybe that accounts for
the slowdown?
···
----
The old wxPyPlot converted all the floats to ints either explicitly or
through a wrapper function. The new code (now checked into CVS) has that
all taken out so conversion is now being done behind the scenes like
wxPython originally did it.
Both the old wxPyPlot code and the new version run at the same speed with
the latest version of wxPython and it is quite a bit slower than before.
The method for checking for ints and converting may still be an issue though
or it may be something completely unrelated. Could the new SWIG be the
culprit?
Here is the profile of the old code where a 25,000 point line and 25,000
square markers are plotted 10 times. wxPyPlot.py:1431(OnPlotDraw4) took
4.127 sec. of which 4.112 sec was in wxPyPlot.py:679(Draw) of which
1.919 sec wxPyPlot.py:218(draw of PolyMarkers) and 1.607 sec
wxPyPlot.py:161(draw of PolyLine).
Before, 10 PolyLines would have taken 0.8 sec for everything. You can see
the old timings in the file header.
Regards,
Gordon Williams
profile.run("wxPyPlot.__test()")
10 plots of Draw4 took: 4.233220 sec.
4308 function calls (4248 primitive calls) in 10.616 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
10 0.000 0.000 0.000 0.000 <string>:0(?)
1 0.000 0.000 10.604 10.604 <string>:1(?)
2 0.000 0.000 0.000 0.000 __init__.py:0(?)
1 0.000 0.000 0.000 0.000
_core.py:2361(InitAllImageHandlers
)
29 0.001 0.000 0.001 0.000 _core.py:2655(Connect)
7 0.000 0.000 0.000 0.000 _core.py:2663(_setOORInfo)
29 0.001 0.000 0.001 0.000 _core.py:2732(Bind)
29 0.001 0.000 0.002 0.000 _core.py:2746(__call__)
26 0.000 0.000 0.000 0.000 _core.py:3085(__del__)
1 0.000 0.000 0.000 0.000 _core.py:3261(__init__)
22 0.001 0.000 0.001 0.000 _core.py:3569(__init__)
1 0.000 0.000 0.000 0.000 _core.py:3750(__init__)
2 0.000 0.000 0.000 0.000 _core.py:3806(__init__)
1 0.000 0.000 0.000 0.000 _core.py:4599(__init__)
1 0.000 0.000 0.000 0.000 _core.py:4612(__del__)
1 0.000 0.000 0.000 0.000
_core.py:4618(_setCallbackInfo)
1 6.427 6.427 10.556 10.556 _core.py:4725(MainLoop)
1 0.000 0.000 0.000 0.000 _core.py:4796(SetTopWindow)
1 0.000 0.000 0.000 0.000
_core.py:4834(SetUseBestVisual)
1 0.008 0.008 0.023 0.023 _core.py:4925(_BootstrapApp)
1 0.000 0.000 0.000 0.000 _core.py:4945(__init__)
1 0.001 0.001 0.024 0.024 _core.py:5172(__init__)
1 0.000 0.000 0.000 0.000 _core.py:5253(SetTopWindow)
1 0.000 0.000 10.556 10.556 _core.py:5260(MainLoop)
1 0.000 0.000 0.000 0.000 _core.py:5275(RestoreStdio)
1 0.000 0.000 0.000 0.000 _core.py:5537(__init__)
4 0.000 0.000 0.000 0.000
_core.py:5890(GetClientSizeTuple)
1 0.004 0.004 0.005 0.005 _core.py:6179(Show)
1 0.000 0.000 0.000 0.000 _core.py:657(__init__)
2 0.000 0.000 0.000 0.000 _core.py:667(__del__)
1 0.000 0.000 0.000 0.000
_core.py:6948(SetBackgroundColour)
1 0.000 0.000 0.000 0.000 _core.py:7006(SetCursor)
1 0.000 0.000 0.000 0.000 _core.py:7026(SetFont)
50 0.002 0.000 0.003 0.000 _core.py:7038(GetFont)
1 0.000 0.000 0.000 0.000 _core.py:7565(__init__)
3 0.000 0.000 0.000 0.000 _core.py:7795(__init__)
21 0.001 0.000 0.002 0.000 _core.py:7803(Append)
1 0.000 0.000 0.000 0.000 _core.py:787(__init__)
3 0.000 0.000 0.000 0.000 _core.py:8032(__init__)
1 0.000 0.000 0.000 0.000 _core.py:8044(__init__)
3 0.000 0.000 0.000 0.000 _core.py:8052(Append)
1 0.000 0.000 0.000 0.000 _core.py:8154(__init__)
21 0.000 0.000 0.000 0.000 _core.py:8347(__init__)
3 0.000 0.000 0.000 0.000 _gdi.py:1689(__init__)
56 0.001 0.000 0.001 0.000 _gdi.py:1700(__del__)
48 0.001 0.000 0.001 0.000 _gdi.py:1706(Ok)
48 0.001 0.000 0.001 0.000 _gdi.py:1710(__nonzero__)
52 0.001 0.000 0.001 0.000 _gdi.py:1723(GetFamily)
52 0.001 0.000 0.001 0.000 _gdi.py:1727(GetStyle)
52 0.001 0.000 0.001 0.000 _gdi.py:1731(GetWeight)
53 0.001 0.000 0.001 0.000 _gdi.py:1835(__init__)
41 0.001 0.000 0.001 0.000 _gdi.py:198(__init__)
41 0.002 0.000 0.003 0.000 _gdi.py:204(NamedColour)
24 0.001 0.000 0.001 0.000 _gdi.py:2438(__del__)
10 0.000 0.000 0.000 0.000 _gdi.py:2444(BeginDrawing)
10 0.000 0.000 0.000 0.000 _gdi.py:2456(EndDrawing)
480 0.012 0.000 0.012 0.000 _gdi.py:2520(DrawLine)
30 0.003 0.000 0.004 0.000 _gdi.py:270(__init__)
60 0.002 0.000 0.002 0.000 _gdi.py:276(__del__)
240 0.006 0.000 0.006 0.000 _gdi.py:2825(DrawText)
10 0.001 0.000 0.001 0.000
_gdi.py:2910(SetClippingRegion)
10 1.602 0.160 1.602 0.160 _gdi.py:2978(DrawLines)
12 0.001 0.000 0.001 0.000 _gdi.py:3037(Clear)
10 0.000 0.000 0.000 0.000 _gdi.py:306(SetCap)
50 0.002 0.000 0.002 0.000 _gdi.py:3078(SetFont)
30 0.001 0.000 0.001 0.000 _gdi.py:3087(SetPen)
10 0.000 0.000 0.000 0.000 _gdi.py:3098(SetBrush)
10 0.001 0.000 0.001 0.000
_gdi.py:3139(DestroyClippingRegion
)
10 0.000 0.000 0.000 0.000 _gdi.py:3164(GetCharHeight)
170 0.005 0.000 0.005 0.000 _gdi.py:3180(GetTextExtent)
30 0.001 0.000 0.001 0.000 _gdi.py:367(__init__)
10 1.382 0.138 1.382 0.138
_gdi.py:3705(_DrawRectangleList)
10 0.000 0.000 1.383 0.138
_gdi.py:3764(DrawRectangleList)
10 0.000 0.000 0.001 0.000 _gdi.py:383(__init__)
20 0.000 0.000 0.000 0.000 _gdi.py:393(__del__)
12 0.001 0.000 0.001 0.000 _gdi.py:3975(__init__)
28 0.002 0.000 0.002 0.000 _gdi.py:3988(__del__)
12 0.000 0.000 0.000 0.000 _gdi.py:4011(__init__)
2 0.000 0.000 0.000 0.000 _gdi.py:4040(__init__)
2 0.000 0.000 0.000 0.000 _gdi.py:4057(__init__)
12 0.001 0.000 0.002 0.000 _gdi.py:4154(__init__)
12 0.000 0.000 0.000 0.000 _gdi.py:4166(__init__)
10 0.000 0.000 0.000 0.000 _gdi.py:461(__init__)
2 0.000 0.000 0.000 0.000 _gdi.py:488(__del__)
2 0.000 0.000 0.000 0.000 _gdi.py:671(__init__)
2 0.000 0.000 0.000 0.000 _gdi.py:677(EmptyBitmap)
41 0.001 0.000 0.001 0.000 _gdi.py:83(__del__)
1 0.000 0.000 0.000 0.000 _windows.py:3701(__init__)
2 0.001 0.000 0.001 0.000 _windows.py:3710(__del__)
1 0.000 0.000 0.000 0.000
_windows.py:3764(SetOrientation)
1 0.000 0.000 0.000 0.000 _windows.py:3780(SetPaperId)
1 0.000 0.000 0.000 0.000 _windows.py:3891(__init__)
1 0.001 0.001 0.001 0.001 _windows.py:390(__init__)
1 0.000 0.000 0.000 0.000 _windows.py:3902(__init__)
2 0.000 0.000 0.000 0.000 _windows.py:3911(__del__)
1 0.000 0.000 0.000 0.000
_windows.py:4005(SetMarginTopLeft)
1 0.000 0.000 0.000 0.000
_windows.py:4009(SetMarginBottomRi
ght)
1 0.000 0.000 0.000 0.000 _windows.py:4029(SetPrintData)
1 0.000 0.000 0.000 0.000 _windows.py:4036(__init__)
1 0.000 0.000 0.000 0.000 _windows.py:424(SetMenuBar)
1 0.001 0.001 0.001 0.001
_windows.py:437(CreateStatusBar)
1 0.000 0.000 0.000 0.000 _windows.py:516(__init__)
1 0.000 0.000 0.000 0.000 _windows.py:849(__init__)
1 0.000 0.000 0.000 0.000 dialogs.py:130(DialogResults)
1 0.002 0.002 0.019 0.019 dialogs.py:23(?)
1 0.000 0.000 0.000 0.000
dialogs.py:28(ScrolledMessageDialo
g)
1 0.003 0.003 0.022 0.022 dialogs.py:5(?)
1 0.000 0.000 0.000 0.000
dialogs.py:51(MultipleChoiceDialog
)
1 0.001 0.001 0.017 0.017 layoutf.py:10(?)
1 0.000 0.000 0.017 0.017 layoutf.py:13(Layoutf)
0 0.000 0.000 profile:0(profiler)
1 0.012 0.012 10.616 10.616 profile:0(wxPyPlot.__test())
2 0.000 0.000 0.017 0.008 sre.py:177(compile)
2 0.000 0.000 0.017 0.008 sre.py:216(_compile)
18 0.001 0.000 0.004 0.000
sre_compile.py:151(_compile_charse
t)
18 0.002 0.000 0.003 0.000
sre_compile.py:180(_optimize_chars
et)
5 0.001 0.000 0.001 0.000 sre_compile.py:229(_mk_bitmap)
24/2 0.002 0.000 0.006 0.003 sre_compile.py:24(_compile)
14 0.000 0.000 0.001 0.000 sre_compile.py:322(_simple)
2 0.000 0.000 0.001 0.001
sre_compile.py:329(_compile_info)
33 0.000 0.000 0.000 0.000 sre_compile.py:42(<lambda>)
4 0.000 0.000 0.000 0.000 sre_compile.py:438(isstring)
2 0.000 0.000 0.007 0.004 sre_compile.py:444(_code)
2 0.000 0.000 0.017 0.008 sre_compile.py:459(compile)
56 0.000 0.000 0.000 0.000 sre_parse.py:133(__len__)
86 0.001 0.000 0.001 0.000 sre_parse.py:137(__getitem__)
14 0.000 0.000 0.000 0.000 sre_parse.py:139(__setitem__)
14 0.000 0.000 0.000 0.000 sre_parse.py:141(__getslice__)
31 0.000 0.000 0.000 0.000 sre_parse.py:145(append)
38/16 0.001 0.000 0.001 0.000 sre_parse.py:147(getwidth)
2 0.000 0.000 0.000 0.000 sre_parse.py:183(__init__)
97 0.001 0.000 0.001 0.000 sre_parse.py:187(__next)
86 0.001 0.000 0.001 0.000 sre_parse.py:200(match)
87 0.001 0.000 0.002 0.000 sre_parse.py:206(get)
2 0.000 0.000 0.000 0.000
sre_parse.py:240(_class_escape)
13 0.000 0.000 0.000 0.000 sre_parse.py:269(_escape)
10/2 0.000 0.000 0.009 0.004 sre_parse.py:312(_parse_sub)
10/2 0.004 0.000 0.009 0.004 sre_parse.py:367(_parse)
2 0.000 0.000 0.009 0.004 sre_parse.py:614(parse)
2 0.000 0.000 0.000 0.000 sre_parse.py:75(__init__)
8 0.000 0.000 0.000 0.000 sre_parse.py:80(opengroup)
8 0.000 0.000 0.000 0.000 sre_parse.py:91(closegroup)
24 0.000 0.000 0.000 0.000 sre_parse.py:98(__init__)
2 0.007 0.003 0.007 0.003 wxPyPlot.py:101(__init__)
20 0.001 0.000 0.001 0.000
wxPyPlot.py:1011(_axisInterval)
10 0.030 0.003 0.070 0.007 wxPyPlot.py:1042(_drawAxes)
20 0.005 0.000 0.005 0.000 wxPyPlot.py:1086(_ticks)
20 0.117 0.006 0.117 0.006 wxPyPlot.py:113(boundingBox)
10 0.000 0.000 0.000 0.000 wxPyPlot.py:1200(__init__)
480 0.011 0.000 0.023 0.000 wxPyPlot.py:1202(DrawLine)
240 0.005 0.000 0.011 0.000 wxPyPlot.py:1204(DrawText)
10 0.000 0.000 0.001 0.000
wxPyPlot.py:1208(SetClippingRegion
)
330 0.003 0.000 0.003 0.000 wxPyPlot.py:1212(__getattr__)
1 0.002 0.002 10.604 10.604 wxPyPlot.py:1225(__test)
20 0.353 0.018 0.353 0.018 wxPyPlot.py:124(scaleAndShift)
1 0.004 0.004 0.011 0.011
wxPyPlot.py:1281(_draw4Objects)
1 0.000 0.000 0.000 0.000 wxPyPlot.py:1319(AppFrame)
1 0.001 0.001 0.010 0.010 wxPyPlot.py:1320(__init__)
1 0.002 0.002 4.127 4.127 wxPyPlot.py:1431(OnPlotDraw4)
1 0.000 0.000 0.003 0.003 wxPyPlot.py:149(__init__)
1 0.000 0.000 0.000 0.000
wxPyPlot.py:1493(resetDefaults)
1 0.000 0.000 0.000 0.000 wxPyPlot.py:1502(MyApp)
1 0.000 0.000 0.015 0.015 wxPyPlot.py:1503(OnInit)
10 0.002 0.000 1.607 0.161 wxPyPlot.py:161(draw)
1 0.000 0.000 0.003 0.003 wxPyPlot.py:193(__init__)
10 0.002 0.000 1.919 0.192 wxPyPlot.py:218(draw)
10 0.004 0.000 1.911 0.191 wxPyPlot.py:241(_drawmarkers)
10 0.524 0.052 1.907 0.191 wxPyPlot.py:255(_square)
1 0.000 0.000 0.000 0.000 wxPyPlot.py:293(__init__)
10 0.001 0.000 0.118 0.012 wxPyPlot.py:307(boundingBox)
10 0.001 0.000 0.353 0.035 wxPyPlot.py:315(scaleAndShift)
10 0.000 0.000 0.000 0.000
wxPyPlot.py:319(setPrinterScale)
20 0.000 0.000 0.000 0.000 wxPyPlot.py:335(getXLabel)
20 0.000 0.000 0.000 0.000 wxPyPlot.py:339(getYLabel)
20 0.000 0.000 0.000 0.000 wxPyPlot.py:343(getTitle)
10 0.001 0.000 3.527 0.353 wxPyPlot.py:347(draw)
1 0.000 0.000 0.004 0.004 wxPyPlot.py:383(__init__)
1 0.000 0.000 0.000 0.000
wxPyPlot.py:550(SetFontSizeAxis)
1 0.000 0.000 0.000 0.000
wxPyPlot.py:566(SetFontSizeLegend)
1 0.000 0.000 0.000 0.000 wxPyPlot.py:631(SetXSpec)
1 0.000 0.000 0.000 0.000 wxPyPlot.py:640(SetYSpec)
10 0.010 0.001 4.112 0.411 wxPyPlot.py:679(Draw)
2 0.000 0.000 0.001 0.000 wxPyPlot.py:807(Clear)
22 0.000 0.000 0.000 0.000 wxPyPlot.py:829(OnMotion)
2 0.000 0.000 0.001 0.000 wxPyPlot.py:865(OnPaint)
2 0.000 0.000 0.002 0.001 wxPyPlot.py:869(OnSize)
2 0.000 0.000 0.000 0.000 wxPyPlot.py:887(_setSize)
10 0.002 0.000 0.009 0.001
wxPyPlot.py:935(_titleLablesWH)
10 0.000 0.000 0.000 0.000 wxPyPlot.py:947(_legendWH)
50 0.004 0.000 0.011 0.000 wxPyPlot.py:982(_getFont)
10 0.001 0.000 0.001 0.000
wxPyPlot.py:997(_point2ClientCoord
)