Skip to content

perf(madara): optimize chapter pagination, DOM queries, and parser efficiency (v2.3.0) - #2668

Open
7ui77 wants to merge 4 commits into
lnreader:masterfrom
7ui77:perf/madara-optimizations
Open

7ui77 wants to merge 4 commits into
lnreader:masterfrom
7ui77:perf/madara-optimizations

Conversation

@7ui77

@7ui77 7ui77 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Update version code if an existing plugin was modified
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (e.g. Closes #xyz)
  • Commit messages follow type(scope): description (e.g. feat(<generator>): add new source)

Changes

  1. Parallel Chapter Pagination (ajax/chapters/):
    • Replaced sequential for ... await loop with concurrent fetching in batches of 5 (BATCH_SIZE = 5 via Promise.all).
    • Significantly speeds up loading novel chapter lists with multi-page chapters (~3.4x faster on live sites with multiple chapter pages).
  2. DOM Parsing & Date Formatting Optimization:
    • Hoisted dayjs().format('LL') calculation outside of the chapter iteration loop, eliminating repeated locale formatting on large chapter lists.
    • Cached Cheerio link query .find('a') in chapter loop, reducing DOM tree traversals.
    • Fixed selector fallback in parseChapter (loadedCheerio(...) is always truthy) and cleaned bloat tags (script, style, noscript, ads) before extraction.
    • Optimized parseData date parsing by checking for numbers first before creating dayjs instances and avoiding duplicate formatting calls.
  3. Template Generator Optimization:
    • Hoisted template.ts file reading to module scope in generator.js so it is read once into memory instead of re-reading for each source during build:multisrc.
  4. Version Bump:
    • Bumped base version to 2.3.0 and reset existing versionIncrements in sources.json.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Optimizes manga parser and bumps plugin version.

Fix the hidden chapter-page failures before merging.

Findings

  1. P1 Failed pages disappear silently ▶

Summary

This PR speeds up Madara chapter loading and reduces repeated parsing work.

  • Madara loads extra chapter pages in groups of five.
  • Novel cards and details use fewer repeated lookups.
  • Chapter rows reuse link and date work while keeping dates readable.
  • Chapter pages choose a matching content area and remove embedded clutter.
  • Madara plugins now report version 2.3.x.
  • The Madara builder reads its shared template just once.

Reviews (1) · Last reviewed commit: "chore(madara): remove versionIncrements ..." · Reviewed by Greptile

Comment thread plugins/multisrc/madara/template.ts Outdated

This branch has not been deployed

No deployments
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.

1 participant