FG
Filip Galeković
2mo ago
#29

Excrutiatingly slow import, and import doesn't read cache on retry

The EPUB imports are insanely slow for me. My M4 Max also spins up like crazy while doing imports of a large EPUB pile. Does the app convert the epubs? What is it doing? Code compilation takes less time than it does for it to import a few EPUBs for me. Also, if i import my epubs, then run the import again for the same batch of epubs, the import will take just as long. The app should do a hash check and skip duplicate files.

Review 2

3 people liked this

2 comments

Thanks, both fair criticisms.

On what import does (no, EPUBs are not re-encoded, but it's not just metadata extraction either):

Parses the EPUB and pulls metadata
Runs a repair pipeline for common defects (broken ZIP containers, malformed XHTML, broken NCX, bad language tags). Repairs require unzip → mutate → re-zip, which is genuinely expensive.
Converts MOBI and KEPUB to EPUB (only those formats)
Computes a SHA-256 (used for dedup and CloudKit identity), extracts the cover, saves to Core Data, triggers iCloud sync
So if your batch includes EPUBs that need repair (older Calibre exports often do) or any MOBI/KEPUB files, the per-file work adds up. The repairs are why some EPUBs render here when they fail elsewhere, but I've logged a perf investigation to make sure nothing is slower than it needs to be.

On the re-import cache: there is a dedup check, but you've spotted a real flaw. It compares SHA-256 hashes, and the hash is computed before that check runs, so the second import still pays the full file-read cost. I've filed a fix: pre-check by filename + size + modification time, and only fall through to hashing if those don't match a known book. That should make repeat imports near-instant.

To help me characterize the slowness:

Roughly how many EPUBs and average size?
Local-only on the Mac, or sitting in iCloud Drive? (iCloud eviction can dominate import time and look like a hang.)
Mostly EPUBs, or also MOBI/KEPUB?

BookShelves Dev Team · 2mo ago

To help me characterize the slowness
Local only on the Mac
This was done with 130 EPUBs and 11 MOBIs. 220MB total.

Filip Galeković · 2mo ago

Sign in

Sign in to post, comment, and vote.

Sign in with Apple Sign in with Google