Keep ZipFile open to speed up getting file stats. (#76)

Still a bit raw, but gets the time required to determine the size of
each chapter (for reading progress) down from ~25ms to 0-1ms.

This is done by keeping the zipArchive open (so simple ;)).

Probably we don't need to cache the spine sizes anymore then...

---------

Co-authored-by: Dave Allie <dave@daveallie.com>
This commit is contained in:
Jonas Diemer
2025-12-21 14:38:51 +11:00
committed by GitHub
co-authored by Dave Allie
parent 7d4e236dd0
commit 7a526183a0
4 changed files with 23 additions and 47 deletions
+1
View File
@@ -33,6 +33,7 @@ class Epub {
bool parseContentOpf(const std::string& contentOpfFilePath);
bool parseTocNcxFile();
void initializeSpineItemSizes();
static bool getItemSize(const ZipFile& zip, const std::string& itemHref, size_t* size);
public:
explicit Epub(std::string filepath, const std::string& cacheDir) : filepath(std::move(filepath)) {