Lazily load file entry icons
ClosedPublic

Authored by nicolasfella on Jan 2 2020, 2:21 AM.

Details

Summary

Building the icons datastructure is the most significant bottleneck when opening large archives. Knowing all the icons at loading time is unnecessary since most elements won't be visible anyway.
This patch moves the icon storing into the Entry class where it is lazily determined the first time it is accessed. This improves the initial archive loading time significantly.

Test Plan

It's hard to give exact numbers, but my main test archive (the Android NDK) went from ~3 seconds to load to "pretty much instant"

Diff Detail

Repository
R36 Ark
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Jan 2 2020, 2:21 AM
Restricted Application added a project: Ark. · View Herald TranscriptJan 2 2020, 2:21 AM
Restricted Application added a subscriber: kde-utils-devel. · View Herald Transcript
nicolasfella requested review of this revision.Jan 2 2020, 2:21 AM
nicolasfella retitled this revision from Store entry icon in entry class to Lazily load file entry icons.Jan 2 2020, 2:22 AM
broulik added a subscriber: broulik.Jan 7 2020, 9:45 AM
broulik added inline comments.
kerfuffle/archiveentry.cpp
212

Potentially you could even cache this icon as it's not going to change

kerfuffle/archiveentry.h
132

If you made this mutable you could keep icon() const and save you some const_cast

nicolasfella marked 2 inline comments as done.Jan 9 2020, 11:23 PM
elvisangelaccio accepted this revision.Mar 14 2020, 11:23 AM
This revision is now accepted and ready to land.Mar 14 2020, 11:23 AM
This revision was automatically updated to reflect the committed changes.