mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-07 20:34:14 +02:00
DiagramPosition: compile the letter filter once
The constructor built QRegularExpression("[^A-Z]") on every call, and
compiling it cost more than the rest of Diagram::convertPosition() put
together -- about 95k instructions a call under callgrind. Every element
row of the project database pays it on each rebuild, as does anything
else that turns a scene point into a folio cell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,11 @@
|
||||
DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) {
|
||||
// purifie les lettres
|
||||
letter_ = letter.toUpper();
|
||||
letter_.remove(QRegularExpression("[^A-Z]"));
|
||||
//Compiled once: building it here cost more than the rest of the
|
||||
//position conversion together, once per element and per drawing item
|
||||
//on every rebuild of the project database.
|
||||
static const QRegularExpression not_a_letter(QStringLiteral("[^A-Z]"));
|
||||
letter_.remove(not_a_letter);
|
||||
number_ = number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user