Skip to content

Conversation

mickael-menu
Copy link
Member

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.

Copy link

@Copilot Copilot AI left a 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 equivalent subscript 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.

@mickael-menu mickael-menu merged commit 86d2533 into develop Aug 22, 2025
5 checks passed
@mickael-menu mickael-menu deleted the issue/639 branch August 22, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some LCP protected ebooks take too long to open
1 participant