Commit 8e436fad authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Optimize ArchiveModel::cleanFileName

Summary: Creating the QRegularExpression is expensive and cleanFileName is called for each entry. By not re-creating the regex we gain a significant archive load time improvement

Test Plan:
{F7786657}

Left is before, right is after. Note the red block on the left that isn't present on the right

Reviewers: #ark, elvisangelaccio

Reviewed By: #ark, elvisangelaccio

Subscribers: elvisangelaccio, kde-utils-devel

Tags: #ark

Differential Revision: https://phabricator.kde.org/D25565
parent 15c9cc6b
......@@ -341,7 +341,7 @@ QString ArchiveModel::cleanFileName(const QString& fileName)
{
// Skip entries with filename "/" or "//" or "."
// "." is present in ISO files.
QRegularExpression pattern(QStringLiteral("/+|\\."));
static QRegularExpression pattern(QStringLiteral("/+|\\."));
QRegularExpressionMatch match;
if (fileName.contains(pattern, &match) && match.captured() == fileName) {
qCDebug(ARK) << "Skipping entry with filename" << fileName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment