Skip to content

perf(lnori): open novels fast on phones - #2446

Open
lipexama wants to merge 1 commit into
lnreader:masterfrom
lipexama:lnori-lighter-parse
Open

perf(lnori): open novels fast on phones#2446
lipexama wants to merge 1 commit into
lnreader:masterfrom
lipexama:lnori-lighter-parse

Conversation

@lipexama

Copy link
Copy Markdown

What

Opening a novel on LNORI downloads every volume page at once (~0.5MB each, dozens for a long series) and fully parses each page with cheerio, only to read its table of contents. On a phone (Hermes, no JIT) that is ~a minute of loading skeletons for a series like Re:ZERO, and because the fetches run in one Promise.all, a single failed request fails the entire novel.

This change:

  • parses just the page's <nav> table of contents (a few KB) when it can name every chapter, falling back to the full page when it cannot
  • fetches volume pages four at a time instead of all at once

Verification

Ran the published 1.0.0 build and this branch's compiled output side by side against the live site on four titles — Re:ZERO (305ch), Classroom of the Elite (345ch), 86 (187ch), Mushoku Tensei (418ch). Chapter lists are byte-identical in all four cases. HTML handed to cheerio across the four novels drops from 58.3MB to 0.4MB.

Also exercised in the app on an iOS simulator: browse → novel → chapter all work.

Checklist

  • Update version code if an existing plugin was modified (1.0.0 → 1.0.1)
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (none known)

🤖 Generated with Claude Code

Building a chapter list downloaded every volume page at once (~0.5MB
each, dozens for a long series) and parsed each whole page, only to read
its table of contents. On mobile that meant ~a minute of loading
skeletons, and any single failed request failed the entire novel.
Parse just the page's <nav> table of contents (a few KB) when it can
name every chapter, falling back to the full page when it cannot, and
fetch volumes four at a time.
Verified against the live site on four titles (Re:ZERO, Classroom of
the Elite, 86, Mushoku Tensei): chapter lists are byte-identical to
1.0.0, with HTML handed to the parser dropping from 58.3MB to 0.4MB
across the four.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MonomoySama

Copy link
Copy Markdown

in my android 10 phone, opening any chapter gives me error "chapter section not found" but if i turn on VPN and open it again, it works

Sign up for freeto 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.

2 participants

@lipexama@MonomoySama