PlotPyStack / PlotPy

Curve and image plotting tools for Python/Qt applications
BSD 3-Clause "New" or "Revised" License
28 stars 2 forks source link

Performance degradation with Qt6 #22

Open PierreRaybaut opened 1 month ago

PierreRaybaut commented 1 month ago

While the whole stack (PythonQwt, guidata and PlotPy) is compatible with PyQt5, PyQt6 and PySide6, there are some differences in terms of performance between Qt5 and Qt6.

For example, the following benchmark has been done on Windows 10 with Python 3.10 (on a quite limited VM): image

In other words, results are +50% slower with PyQt6 (and almost +100% slower with PySide6) than with PyQt5.

We need to investigate this and to come with an action plan before Qt5 end-of-life, that is May 25th 2025.

PierreRaybaut commented 1 month ago

Here are the profiling stats: image

We can see that some intermediate level methods (in PythonQwt) are called ~2x more when using Qt6. When tracking back the call stack, it seems that this is due to an internal change in Qt which has the effect of calling internal methods related to widget resizing and drawing twice more than before. In other words, there is not much we can do in PlotPyStack (in PythonQwt, to be precise) apart from avoiding unnecessary widget refresh calls, but this kind of optimization has already been done in PythonQwt. profiling_stats-PyQt5.txt profiling_stats-PyQt6.txt profiling_stats-PySide6.txt