Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize derived class construction #753

Merged
merged 3 commits into from
Jan 5, 2025
Merged

Conversation

bnoordhuis
Copy link
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
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
59 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inefficient bytecode for constructor-less ES6 child classes
2 participants