mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 13:24:14 +02:00
a8df5e3df9
setPainterStyle() built its QRegularExpression as a local, so the pattern was compiled from scratch on every call -- and it is called for every graphics primitive of every element instance a project places. A callgrind profile of opening examples/affuteuse_250h.qet put 28 % of all instructions inside libpcre2, and 12 % of the whole run inside this one function. Making it static const compiles the pattern once for the life of the process. Nothing else changes: same pattern, same matching, same named captures. Measured with callgrind, which counts instructions and so does not depend on what else the machine is doing, opening examples/affuteuse_250h.qet: 4,801,381,735 -> 4,297,629,948 instructions (-10.5 %) setPainterStyle 582 M (12.13 %) -> 79 M (1.83 %) --info stays byte identical on all 23 example projects, and so does every SVG this produces for industrial.qet -- which is the output that would change if the styles were parsed any differently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N64mk33R9GdbU1PkYcc9SP