Skip to content

Optimize derived class construction#753

Merged
bnoordhuis merged 3 commits intoquickjs-ng:masterfrom
bnoordhuis:fix752
Jan 5, 2025
Merged

Optimize derived class construction#753
bnoordhuis merged 3 commits intoquickjs-ng:masterfrom
bnoordhuis:fix752

Conversation

@bnoordhuis
Copy link
Copy Markdown
Contributor

We were emitting a gob of inefficient bytecode that created an arguments array on the stack, then applied it to the parent constructor.

Add a new opcode for initializing a derived class. Speeds up construction by 500%, although sadly that is not visible in the web-tooling-benchmark, only in microbenchmarks.

Fixes: #752

@bnoordhuis
Copy link
Copy Markdown
Contributor Author

Amusingly, the abort happens right in the code we were discussing the other day in #782 because sf->cur_pc is not set. What are the odds? :)

We were emitting a gob of inefficient bytecode that created an arguments
array on the stack, then applied it to the parent constructor.

Add a new opcode for initializing a derived class. Speeds up construction
by 500%, although sadly that is not visible in the web-tooling-benchmark,
only in microbenchmarks.

Fixes: quickjs-ng#752
@bnoordhuis bnoordhuis merged commit 5b609f1 into quickjs-ng:master Jan 5, 2025
@bnoordhuis bnoordhuis deleted the fix752 branch January 5, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants