Skip to content

fix(zh.sources): compile chapter number regexes once via spin::Lazy - #833

Open
dyphire wants to merge 1 commit into
Aidoku-Community:mainfrom
dyphire:zh.godamanga
Open

dyphire wants to merge 1 commit into
Aidoku-Community:mainfrom
dyphire:zh.godamanga

Conversation

@dyphire

@dyphire dyphire commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Per-chapter Regex::new recompilation made manga details calls unusably slow on interpreted WASM runtimes and blew fuel budgets on long series (#829).

Compile the chapter-number regexes once with spin::Lazy in zh.godamanga, zh.baozimanhua, zh.bilimanga, zh.manhuagui, zh.dm5, zh.mangabz and zh.mycomic, and bump their versions.

Close #829

Comment thread sources/zh.baozimanhua/src/html/mod.rs Outdated

// Compile the regexes once instead of per chapter to keep the details call
// fast on interpreted runtimes (see Aidoku-Community/sources#829).
static CHAPTER_RES: Lazy<Vec<Regex>> = Lazy::new(|| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need a vector. this could just be a [Regex; 3] array.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix

Per-chapter Regex::new recompilation made manga details calls unusably
slow on interpreted WASM runtimes and blew fuel budgets on long series
(Aidoku-Community#829).

Compile the chapter-number regexes once with spin::Lazy in zh.godamanga,
zh.baozimanhua, zh.bilimanga, zh.manhuagui, zh.dm5, zh.mangabz and
zh.mycomic, and bump their versions.

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.

zh.godamanga: chapter loading is slow

2 participants