From 6b836545607ad26a8372b3213bcbb7fd9405e036 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 21 Oct 2023 10:19:00 +0200 Subject: [PATCH] useractions: Use static regex The method is called quite often during KWins lifetime. Because the pattern is constant, we can reuse the value instead of creating a new regex every time --- src/useractions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useractions.cpp b/src/useractions.cpp index b7c17f9bb1..b8bc735921 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -1791,7 +1791,7 @@ void Window::setShortcut(const QString &_cut) } return; } - const QRegularExpression reg(QStringLiteral("(.*\\+)\\((.*)\\)")); + static const QRegularExpression reg(QStringLiteral("(.*\\+)\\((.*)\\)")); QList keys; const QStringList groups = cut.split(QStringLiteral(" - ")); for (auto it = groups.begin(); it != groups.end(); ++it) {