Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Optimize the opening of really large LCP publications#640

Merged
mickael-menu merged 1 commit intodevelopfrom
issue/639
Aug 22, 2025
Merged

Optimize the opening of really large LCP publications#640
mickael-menu merged 1 commit intodevelopfrom
issue/639

Conversation

Copy link
Member

mickael-menu commented Aug 22, 2025

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.

mickael-menu requested a review from Copilot August 22, 2025 16:52
mickael-menu temporarily deployed to LCP August 22, 2025 16:52 -- with GitHub Actions Inactive
mickael-menu temporarily deployed to LCP August 22, 2025 16:52 -- with GitHub Actions Inactive
Copilot AI reviewed Aug 22, 2025
Copy link

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 mentioned this pull request Aug 22, 2025
mickael-menu merged commit 86d2533 into develop Aug 22, 2025
5 checks passed
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

Reviewers

Copilot code review Copilot Copilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Some LCP protected ebooks take too long to open

2 participants