dlr-gtlab / gtlab-core

GTlab Core Framework
https://www.gtlab.de
Other
7 stars 2 forks source link

Improve performance of python console output #1140

Closed rainman110 closed 6 months ago

rainman110 commented 8 months ago

Description

Just a small fix to avoid copies in for loops, which turned out to be a hot spot in the syntax highlighter.

This is just a part of the performance fix. The rest need to be done in the python module itself.

Fixes #1139

How Has This Been Tested?

Manually and via Performance Analysis in Visual Studio. Before, the for loop took a significant amount of the computing time.

Checklist:

mariusalexander commented 6 months ago

have you tried to use a range based for loop instead (together with qAsConst) )? foreach does a copy of the container, which for Qt types is fast but this might be faster still. especially if you do not modify the range

https://doc.qt.io/qt-6/foreach-keyword.html

rainman110 commented 6 months ago

have you tried to use a range based for loop instead (together with qAsConst) )? foreach does a copy of the container, which for Qt types is fast but sthis might be faster still. especially if you do not modify the range

No. It will probably do not harm to add qAsConst.

rainman110 commented 6 months ago

@mariusalexander I added qAsConst as suggested