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

Set the array "length" property in [[DefineOwnProperty]] based on the array shape #4101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raskad
Copy link
Member

@raskad raskad commented Dec 29, 2024

This optimization is especially useful for array literal construction. Instead of calling OrdinaryGetOwnProperty and OrdinaryDefineOwnProperty on the array object while setting the "length" property, all of that can be skipped if the shape of the array has not changed.

@raskad raskad added performance Performance related changes and issues execution Issues or PRs related to code execution labels Dec 29, 2024
@raskad raskad added this to the next-release milestone Dec 29, 2024
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 48,625 48,625 0
Passed 43,947 43,947 0
Ignored 1,471 1,471 0
Failed 3,207 3,207 0
Panics 0 0 0
Conformance 90.38% 90.38% 0.00%

@raskad
Copy link
Member Author

raskad commented Dec 29, 2024

As you can see the Splay benchmark benefits a lot from this change, since it constructs an array literal during execution.

Before:

RESULT Richards 131
RESULT DeltaBlue 115
RESULT Crypto 120
RESULT RayTrace 277
RESULT EarleyBoyer 365
RESULT RegExp 64.1
RESULT Splay 525
RESULT NavierStokes 341
SCORE 195

After:

RESULT Richards 132
RESULT DeltaBlue 114
RESULT Crypto 118
RESULT RayTrace 276
RESULT EarleyBoyer 367
RESULT RegExp 62.5
RESULT Splay 672
RESULT NavierStokes 340
SCORE 200

@raskad raskad requested a review from a team December 29, 2024 15:26
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Nice optimization!

@jedel1043 jedel1043 requested a review from a team December 29, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execution Issues or PRs related to code execution performance Performance related changes and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants