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
Details
Details
- Reviewers
elvisangelaccio - Group Reviewers
Ark - Commits
- R36:8e436fad4cd1: Optimize ArchiveModel::cleanFileName
R36:b9e0da8c3e16: Optimize ArchiveModel::cleanFileName
Left is before, right is after. Note the red block on the left that isn't present on the right
Diff Detail
Diff Detail
- Repository
- R36 Ark
- Branch
- cleanfilename
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 19214 Build 19232: arc lint + arc unit
Comment Actions
Interesting. How did you test this? Just opening an archive?
part/archivemodel.cpp | ||
---|---|---|
346 | Why remove the debug line though? |
Comment Actions
I tested it by opening a rather large zip (the Android NDK).
The culprit seems to be frequent re-creation of the QRegularExpression object. Since we don't change it we can share it between the function calls which simplifies the patch and keeps the exact original behavior.