-
Notifications
You must be signed in to change notification settings - Fork 129
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
Inefficient bytecode for constructor-less ES6 child classes #752
Comments
Hum, how come Also, looks like this was changed in a8a5ecb any chance it was made somehow worse? |
It does - ⬆️ is the bytecode for when
With 20/20 hindsight it would've probably been better to add and emit a specialized opcode but 🤷, Divy's commit at least improved spec conformance. |
Ah hold on. You mean all of that happens even when there is no constructor which calls super?! |
Yep, that's right. It essentially synthesizes a constructor because of this: class A { constructor(x) { print(x) } }
class B extends A { /* no constructor */ }
new B(42) // prints 42 |
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
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
Refs: #750
Ex.
Emits:
https://github.com/quickjs-ng/quickjs/blob/4b9d0ebdba3ace6b7f6de21c3e3806ab4055bd7e/quickjs.c#L21898-L21938
Pretty bulky and inefficient (splatting
arguments
, doing js_function_apply, etc.) Probably better handled through a dedicated opcode.Affects WBT benchmarks like babylon that create tons of such objects.
The text was updated successfully, but these errors were encountered: