I want to report the result that I compared the drawing speed of wx, qt, cv, and matplotlib using the following packages.
- wx.version 4.1.1 msw (phoenix) wxWidgets 3.1.5
- scipy/numpy version 1.6.0/1.20.1
- matplotlib verison 3.4.2
- Image verison 8.1.0
- cv2 verison 4.5.1
- pyqtgraph 0.12.2
- PySide2 5.15.2
Tested with VAIO CORE i3-2350M Windows10 64 bit OS (my poor PC)
|3||test_wx_bmp||22.5 fps||wx using StaticBitmap|
|4||test_wx_dc1||22.5 fps||wx using DC single buffering|
|5||test_wx_dc2||22.2 fps||wx using DC double buffering|
|6||test_wx_agg||16.1 fps||matplotlib with wxagg backend|
|7||test_mpl||10.6 fps||matplotlib with pyplot|
test-drawing-speed.zip (5.2 KB)
- Pyqtgraph (1) is the fastest as far as I know.
- OpenCV (2) is a little bit slower than Qt but fast enough.
- Wx is twice as slow as OpenCV. Interestingly, using StaticBitmap (3), PaintDC (4), and BufferedPaintDC (5) makes no difference except for the effect of flicker.
- wxWidgets doesn’t support grayscale images. So, we have to make an RGB image first and convert it to a grayscale bitmap. I think this is probably the cause of the overhead.
- It is interesting that wxagg (6) is faster than the native viewer of matplotlib (7). In addition, when you make the window size smaller, it becomes even faster than wx bitmap (3,4,5) drawing!
I would appreciate it if you could tell me anything about other high-speed libraries, how to make wx code even faster, anything to improve code in my attached file, etc.