-
Notifications
You must be signed in to change notification settings - Fork 203
Optimize the opening of really large LCP publications#640
Optimize the opening of really large LCP publications#640mickael-menu merged 1 commit intodevelopfrom
Conversation
Large LCP-protected publications (e.g. 8k entries) were slow to open because we re-normalized all the URLs in the manifest each time we checked a single entry. Now, URLs are pre-normalized, and we only normalize the specific URL being checked.
Fixed
Streamer
- #639 Optimized the opening of really large LCP protected publications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes the opening of large LCP-protected publications by pre-normalizing URLs in manifests and removing the need to re-normalize all URLs when checking individual entries. The optimization addresses performance issues with publications containing thousands of entries (e.g., 8k entries).
- Removed the
equivalentsubscript that performed URL normalization on each lookup - Pre-normalized URLs during parsing to avoid repeated normalization operations
- Updated all dictionary lookups to use direct key access instead of equivalent matching
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Shared/Toolkit/URL/URLProtocol.swift | Removed the equivalent subscript extension that performed expensive URL normalization on each lookup |
| Sources/Streamer/Parser/EPUB/EPUBEncryptionParser.swift | Added URL normalization during parsing to pre-normalize encryption resource URIs |
| Sources/Streamer/Parser/EPUB/OPFParser.swift | Pre-normalized URLs during link creation and updated encryption lookups to use direct key access |
| Sources/Streamer/Parser/EPUB/Resource Transformers/EPUBDeobfuscator.swift | Pre-normalized relative URLs and updated encryption lookups to use direct key access |
| Sources/Streamer/Parser/Image/ImageParser.swift | Updated format lookups to use direct key access instead of equivalent matching |
| Sources/Streamer/Parser/Audio/AudioParser.swift | Updated format lookups to use direct key access instead of equivalent matching |
| Sources/Navigator/EPUB/EPUBNavigatorViewController.swift | Updated table of contents title lookups to use direct key access |
| Sources/Navigator/Audiobook/PublicationMediaLoader.swift | Updated resource lookups to use direct key access |
| CHANGELOG.md | Added entry documenting the optimization fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.