Skip to content

lazy builtins - #3973

Open
jasonwilliams wants to merge 11 commits into
boa-dev:mainfrom
jasonwilliams:lazy-part-2
Open

jasonwilliams wants to merge 11 commits into
boa-dev:mainfrom
jasonwilliams:lazy-part-2

Conversation

@jasonwilliams

@jasonwilliams jasonwilliams commented Aug 29, 2024 •

Copy link
Copy Markdown
Member

Lazy Builtins

So, this creates 2 new data structs which are used inside of JS Objects. LazyBuiltIn and LazyPrototype.
Instead of calling initialize on array for example, we will setup array with a constructor that has a LazyBuiltin object and a prototype which lazy a LazyPrototype. If any properties or the constructor itself is called then we will call init at that point.

For now I've started with:

  • Array

I also updated the VSCode task to always choose the debug/script.js path, as it makes debugging much faster

Closes #2307

@jasonwilliams jasonwilliams mentioned this pull request Aug 29, 2024
Comment thread core/engine/src/builtins/builder.rs Resolved
@codecov

codecov Bot commented Nov 9, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.18182% with 148 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.17%. Comparing base (6ddc2b4) to head (9dc2ac4).
⚠️ Report is 1061 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/object/builtins/lazy_prototype.rs 0.00% 62 Missing ⚠️
core/engine/src/object/builtins/lazy_builtin.rs 39.02% 50 Missing ⚠️
...engine/src/object/builtins/lazy_array_prototype.rs 67.74% 20 Missing ⚠️
core/engine/src/realm.rs 55.00% 9 Missing ⚠️
core/engine/src/object/jsobject.rs 63.63% 4 Missing ⚠️
core/engine/src/builtins/function/mod.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3973      +/-   ##
==========================================
+ Coverage   47.24%   53.17%   +5.92%     
==========================================
  Files         476      487      +11     
  Lines       46892    47986    +1094     
==========================================
+ Hits        22154    25516    +3362     
+ Misses      24738    22470    -2268     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasonwilliams jasonwilliams added the A-Performance Performance related changes and issues label Nov 9, 2024
@jasonwilliams
jasonwilliams marked this pull request as ready for review November 9, 2024 22:06
@jedel1043

Copy link
Copy Markdown
Member

Test262 conformance changes

Test result main count PR count difference
Total 48,494 48,494 0
Passed 43,609 43,581 -28
Ignored 1,500 1,500 0
Failed 3,385 3,413 +28
Panics 0 2 +2
Conformance 89.93% 89.87% -0.06%
Broken tests (26):
test/language/statements/for-of/arguments-unmapped-mutation.js (previously Passed)
test/language/statements/for-of/arguments-unmapped-aliasing.js (previously Passed)
test/language/statements/for-of/arguments-mapped-aliasing.js (previously Passed)
test/language/statements/for-of/arguments-mapped-mutation.js (previously Passed)
test/language/statements/for-of/arguments-unmapped.js (previously Passed)
test/language/statements/for-of/arguments-mapped.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-truncation-before-exhaustion.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-mapped-iteration.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-iteration.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-expansion-before-exhaustion.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-mapped-expansion-after-exhaustion.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-expansion-after-exhaustion.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-mapped-expansion-before-exhaustion.js (previously Passed)
test/built-ins/ArrayIteratorPrototype/next/args-mapped-truncation-before-exhaustion.js (previously Passed)
test/built-ins/String/prototype/S15.5.4_A2.js (previously Passed)
test/built-ins/String/prototype/S15.5.4_A3.js (previously Passed)
test/built-ins/String/prototype/S15.5.4_A1.js (previously Passed)
test/built-ins/Array/isArray/15.4.3.2-0-5.js (previously Passed)
test/built-ins/Array/prototype/exotic-array.js (previously Passed)
test/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-array.js (previously Passed)
test/built-ins/Array/prototype/concat/create-proto-from-ctor-realm-array.js (previously Passed)
test/built-ins/Array/prototype/slice/create-proto-from-ctor-realm-array.js (previously Passed)
test/built-ins/Array/prototype/map/create-proto-from-ctor-realm-array.js (previously Passed)
test/built-ins/Array/prototype/splice/create-proto-from-ctor-realm-array.js (previously Passed)
test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js (previously Passed)
test/built-ins/TypedArrayConstructors/ctors/no-species.js (previously Passed)
New panics (2):
test/built-ins/Array/prototype/forEach/S15.4.4.18_A1.js (previously Passed)
test/built-ins/Array/prototype/forEach/S15.4.4.18_A2.js (previously Passed)

@jedel1043

Copy link
Copy Markdown
Member

Some tests regressed thanks to the changes. Is it potentially a typo/copypaste error, or do we need to go back to the drawing board?

@hansl

hansl commented Nov 10, 2024 •

Copy link
Copy Markdown
Contributor

I'll hold my review until it's up to date with main and green.

)
}

pub(crate) fn native_function_construct_inner(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So there's been some (minor) performance regressions with this PR and I think its related to this, I'm going to assume because its not [inline]'d this is now calling 2 functions instead of 1, and because its on a hotpath its actually slowed it down. Ill try adding the inline attribute and see if thats what it is, but leaving this here as a reminder.

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

A-Performance Performance related changes and issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[performance] - Opportunity to run parsing before building environment

3 participants