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

ConstructorBuilder, ObjectInitializer, cache standard objects and fix global object attributes #722

Merged
merged 1 commit into from
Oct 3, 2020

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Sep 27, 2020

This Pull Request fixes/closes #613.

It changes the following:

  • Add BuiltIn trait for builtins
  • Fixed global properties/objects/object methods/object properties attributes
  • Made ClassBuilder retun &mut Self
  • Add ConstructorBuilder for constructing constructors (builder pattern)
  • Add ObjectInitializer for constructing objects (builder pattern)
  • Add FunctionBuilder for constructing function objects (builder pattern)
  • Cache core standard objects

@HalidOdat HalidOdat added enhancement New feature or request performance Performance related changes and issues technical debt builtins PRs and Issues related to builtins/intrinsics execution Issues or PRs related to code execution API labels Sep 27, 2020
@codecov
Copy link

codecov bot commented Sep 27, 2020

Codecov Report

Merging #722 into master will decrease coverage by 0.42%.
The diff coverage is 50.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #722      +/-   ##
==========================================
- Coverage   59.28%   58.85%   -0.43%     
==========================================
  Files         156      156              
  Lines        9820     9822       +2     
==========================================
- Hits         5822     5781      -41     
- Misses       3998     4041      +43     
Impacted Files Coverage Δ
boa/src/builtins/array/array_iterator.rs 76.00% <ø> (ø)
boa/src/class.rs 0.00% <0.00%> (ø)
boa/src/lib.rs 86.36% <ø> (ø)
boa/src/builtins/date/mod.rs 67.28% <10.90%> (+10.83%) ⬆️
boa/src/builtins/math/mod.rs 51.87% <14.00%> (-13.89%) ⬇️
boa/src/builtins/console/mod.rs 19.10% <20.00%> (-10.28%) ⬇️
boa/src/builtins/number/mod.rs 60.56% <30.43%> (-1.48%) ⬇️
boa/src/builtins/string/mod.rs 51.84% <32.65%> (-4.69%) ⬇️
boa/src/builtins/function/mod.rs 60.21% <33.33%> (-19.57%) ⬇️
boa/src/builtins/mod.rs 25.80% <35.29%> (+3.22%) ⬆️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87d9e9c...79f581f. Read the comment docs.

@github-actions
Copy link

Benchmark for 662fa96

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 370.4±5.07ns 377.7±16.18ns -1.93%
Arithmetic operations (Full) 242.0±7.06µs 255.2±7.63µs -5.17%
Array access (Execution) 7.8±0.18µs 8.2±0.34µs -4.88%
Array access (Full) 271.2±18.17µs 276.6±10.35µs -1.95%
Array creation (Execution) 3.3±0.06ms 3.6±0.08ms -8.33%
Array creation (Full) 3.7±0.08ms 3.5±0.04ms +5.71%
Array pop (Execution) 1172.7±25.43µs 1272.0±26.75µs -7.81%
Array pop (Full) 1703.7±65.16µs 1602.8±53.50µs +6.30%
Boolean Object Access (Execution) 5.0±0.11µs 4.9±0.23µs +2.04%
Boolean Object Access (Full) 246.5±2.84µs 269.6±11.40µs -8.57%
Clean js (Execution) 736.8±10.40µs 768.7±32.59µs -4.15%
Clean js (Full) 1043.8±24.04µs 1039.0±25.12µs +0.46%
Clean js (Parser) 35.6±0.55µs 35.5±0.68µs +0.28%
Create Realm 456.2±7.08ns 495.5±12.31ns -7.93%
Dynamic Object Property Access (Execution) 5.4±0.15µs 5.4±0.07µs 0.00%
Dynamic Object Property Access (Full) 254.2±6.11µs 267.5±8.36µs -4.97%
Expression (Parser) 7.0±0.19µs 6.8±0.19µs +2.94%
Fibonacci (Execution) 827.8±25.29µs 808.5±23.37µs +2.39%
Fibonacci (Full) 1096.5±27.11µs 1101.9±30.65µs -0.49%
For loop (Execution) 22.3±0.26µs 22.6±0.58µs -1.33%
For loop (Full) 282.3±8.71µs 290.6±6.93µs -2.86%
For loop (Parser) 17.4±0.55µs 17.3±0.38µs +0.58%
Goal Symbols (Parser) 11.7±0.08µs 11.8±0.38µs -0.85%
Hello World (Parser) 3.1±0.37µs 2.9±0.05µs +6.90%
Long file (Parser) 772.6±25.51ns 771.9±17.37ns +0.09%
Mini js (Execution) 680.7±20.34µs 690.3±16.30µs -1.39%
Mini js (Full) 957.9±24.65µs 941.1±16.70µs +1.79%
Mini js (Parser) 31.6±1.32µs 31.4±0.77µs +0.64%
Number Object Access (Execution) 3.9±0.12µs 3.9±0.13µs 0.00%
Number Object Access (Full) 245.0±4.00µs 267.1±7.18µs -8.27%
Object Creation (Execution) 4.6±0.12µs 4.5±0.06µs +2.22%
Object Creation (Full) 251.9±6.68µs 269.4±9.19µs -6.50%
RegExp (Execution) 66.9±3.18µs 66.3±2.07µs +0.90%
RegExp (Full) 332.4±13.41µs 344.8±7.22µs -3.60%
RegExp Literal (Execution) 67.8±1.29µs 69.7±2.35µs -2.73%
RegExp Literal (Full) 330.1±10.34µs 340.7±10.95µs -3.11%
RegExp Literal Creation (Execution) 66.1±2.11µs 64.5±1.39µs +2.48%
RegExp Literal Creation (Full) 326.4±8.41µs 343.5±17.92µs -4.98%
Static Object Property Access (Execution) 4.9±0.09µs 4.7±0.10µs +4.26%
Static Object Property Access (Full) 253.5±19.71µs 269.0±6.69µs -5.76%
String Object Access (Execution) 7.1±0.16µs 7.1±0.28µs 0.00%
String Object Access (Full) 258.9±7.38µs 270.8±5.95µs -4.39%
String comparison (Execution) 6.2±0.15µs 6.3±0.19µs -1.59%
String comparison (Full) 255.8±9.23µs 274.2±11.61µs -6.71%
String concatenation (Execution) 5.1±0.09µs 5.2±0.21µs -1.92%
String concatenation (Full) 251.6±10.03µs 265.2±6.92µs -5.13%
String copy (Execution) 3.9±0.25µs 3.9±0.12µs 0.00%
String copy (Full) 239.5±2.44µs 259.4±8.01µs -7.67%
Symbols (Execution) 3.2±0.04µs 3.3±0.11µs -3.03%
Symbols (Full) 231.5±10.70µs 244.0±7.13µs -5.12%

@HalidOdat HalidOdat changed the title Refactor builtins, cache core standard objects and a uniform way of constructing constructors ConstructorBuilder, ObjectBuilder, cache standard objects and fix global object attributes Sep 28, 2020
@HalidOdat HalidOdat added this to the v0.10.0 milestone Sep 28, 2020
@jasonwilliams jasonwilliams modified the milestones: v0.10.0, v0.11.0 Sep 29, 2020
@HalidOdat HalidOdat changed the title ConstructorBuilder, ObjectBuilder, cache standard objects and fix global object attributes ConstructorBuilder, ObjectInitializer, cache standard objects and fix global object attributes Sep 30, 2020
@HalidOdat HalidOdat marked this pull request as ready for review September 30, 2020 04:25
This was referenced Oct 1, 2020
@HalidOdat HalidOdat modified the milestones: v0.11.0, v0.10.0 Oct 1, 2020
@github-actions
Copy link

github-actions bot commented Oct 1, 2020

Benchmark for 380dfb7

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 342.4±17.52ns 353.9±10.79ns -3.25%
Arithmetic operations (Full) 228.0±10.38µs 237.8±9.76µs -4.12%
Array access (Execution) 7.8±1.08µs 8.1±0.42µs -3.70%
Array access (Full) 246.5±10.96µs 281.8±27.66µs -12.53%
Array creation (Execution) 3.0±0.13ms 2.9±0.17ms +3.45%
Array creation (Full) 3.2±0.16ms 3.4±0.19ms -5.88%
Array pop (Execution) 1044.2±70.64µs 989.0±40.92µs +5.58%
Array pop (Full) 1437.5±48.08µs 1533.9±82.62µs -6.28%
Boolean Object Access (Execution) 4.9±0.39µs 4.7±0.18µs +4.26%
Boolean Object Access (Full) 239.9±17.24µs 250.8±14.28µs -4.35%
Clean js (Execution) 718.9±41.14µs 691.1±30.58µs +4.02%
Clean js (Full) 943.7±41.38µs 961.6±35.02µs -1.86%
Clean js (Parser) 34.3±2.12µs 33.3±1.19µs +3.00%
Create Realm 422.0±16.73ns 421.5±13.96ns +0.12%
Dynamic Object Property Access (Execution) 5.4±0.21µs 5.4±0.24µs 0.00%
Dynamic Object Property Access (Full) 259.5±18.15µs 262.4±13.37µs -1.11%
Expression (Parser) 6.5±0.59µs 6.2±0.24µs +4.84%
Fibonacci (Execution) 840.4±46.35µs 893.4±81.26µs -5.93%
Fibonacci (Full) 1099.3±86.81µs 1194.7±146.01µs -7.99%
For loop (Execution) 21.6±0.98µs 22.0±1.67µs -1.82%
For loop (Full) 282.6±14.00µs 288.5±17.68µs -2.05%
For loop (Parser) 16.6±0.82µs 16.5±0.80µs +0.61%
Goal Symbols (Parser) 11.0±0.47µs 11.0±0.43µs 0.00%
Hello World (Parser) 3.2±0.22µs 2.9±0.17µs +10.34%
Long file (Parser) 726.9±28.52ns 724.8±34.70ns +0.29%
Mini js (Execution) 672.2±50.92µs 627.3±65.01µs +7.16%
Mini js (Full) 926.7±85.45µs 876.9±32.05µs +5.68%
Mini js (Parser) 31.6±2.64µs 29.4±1.07µs +7.48%
Number Object Access (Execution) 3.8±0.17µs 3.6±0.13µs +5.56%
Number Object Access (Full) 244.7±30.02µs 254.6±59.82µs -3.89%
Object Creation (Execution) 4.6±0.25µs 4.4±0.22µs +4.55%
Object Creation (Full) 246.7±15.67µs 251.6±13.92µs -1.95%
RegExp (Execution) 64.1±3.51µs 67.4±3.70µs -4.90%
RegExp (Full) 319.4±12.27µs 331.6±15.64µs -3.68%
RegExp Literal (Execution) 67.0±3.16µs 70.0±3.14µs -4.29%
RegExp Literal (Full) 317.3±15.52µs 347.3±54.42µs -8.64%
RegExp Literal Creation (Execution) 67.0±2.62µs 67.4±5.04µs -0.59%
RegExp Literal Creation (Full) 318.5±17.36µs 323.5±17.65µs -1.55%
Static Object Property Access (Execution) 4.8±0.24µs 4.8±0.27µs 0.00%
Static Object Property Access (Full) 251.7±16.60µs 256.7±11.36µs -1.95%
String Object Access (Execution) 6.9±0.36µs 6.9±0.17µs 0.00%
String Object Access (Full) 241.8±9.43µs 253.0±12.07µs -4.43%
String comparison (Execution) 6.4±0.44µs 6.2±0.36µs +3.23%
String comparison (Full) 250.5±21.11µs 250.7±8.72µs -0.08%
String concatenation (Execution) 5.2±0.20µs 5.4±0.32µs -3.70%
String concatenation (Full) 233.6±13.56µs 260.6±14.10µs -10.36%
String copy (Execution) 4.0±0.19µs 4.0±0.23µs 0.00%
String copy (Full) 244.4±12.17µs 237.9±8.30µs +2.73%
Symbols (Execution) 3.2±0.33µs 3.0±0.15µs +6.67%
Symbols (Full) 224.7±11.23µs 228.9±14.52µs -1.83%

@github-actions
Copy link

github-actions bot commented Oct 1, 2020

Benchmark for 65d95ae

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 336.6±20.33ns 369.2±14.58ns -8.83%
Arithmetic operations (Full) 220.3±7.27µs 237.0±11.49µs -7.05%
Array access (Execution) 8.1±0.63µs 8.2±0.43µs -1.22%
Array access (Full) 265.1±15.83µs 281.1±12.24µs -5.69%
Array creation (Execution) 2.9±0.13ms 3.0±0.19ms -3.33%
Array creation (Full) 3.2±0.15ms 3.5±0.18ms -8.57%
Array pop (Execution) 1042.0±49.50µs 1004.6±48.99µs +3.72%
Array pop (Full) 1489.3±92.97µs 1645.8±77.99µs -9.51%
Boolean Object Access (Execution) 4.8±0.28µs 4.7±0.29µs +2.13%
Boolean Object Access (Full) 231.6±6.51µs 253.5±12.68µs -8.64%
Clean js (Execution) 744.0±31.75µs 719.7±31.03µs +3.38%
Clean js (Full) 927.9±35.23µs 979.5±42.45µs -5.27%
Clean js (Parser) 34.4±1.48µs 36.0±2.14µs -4.44%
Create Realm 453.8±25.37ns 459.8±20.78ns -1.30%
Dynamic Object Property Access (Execution) 5.6±0.44µs 5.2±0.33µs +7.69%
Dynamic Object Property Access (Full) 246.7±20.33µs 264.0±12.29µs -6.55%
Expression (Parser) 6.1±0.25µs 6.4±0.38µs -4.69%
Fibonacci (Execution) 857.0±60.17µs 867.9±40.81µs -1.26%
Fibonacci (Full) 1104.0±70.35µs 1142.6±72.16µs -3.38%
For loop (Execution) 21.4±0.74µs 22.2±0.74µs -3.60%
For loop (Full) 269.0±22.50µs 284.9±18.36µs -5.58%
For loop (Parser) 16.7±0.88µs 16.3±0.75µs +2.45%
Goal Symbols (Parser) 11.3±0.43µs 11.0±0.55µs +2.73%
Hello World (Parser) 3.0±0.21µs 2.9±0.20µs +3.45%
Long file (Parser) 739.9±48.42ns 726.0±23.89ns +1.91%
Mini js (Execution) 667.2±36.34µs 617.0±28.92µs +8.14%
Mini js (Full) 848.3±29.38µs 887.4±34.12µs -4.41%
Mini js (Parser) 30.1±1.17µs 31.0±2.00µs -2.90%
Number Object Access (Execution) 3.9±0.22µs 3.5±0.21µs +11.43%
Number Object Access (Full) 245.8±12.87µs 246.0±14.44µs -0.08%
Object Creation (Execution) 4.5±0.24µs 4.6±0.25µs -2.17%
Object Creation (Full) 248.2±13.63µs 271.1±14.26µs -8.45%
RegExp (Execution) 69.1±4.49µs 66.2±4.26µs +4.38%
RegExp (Full) 326.9±18.12µs 334.6±17.14µs -2.30%
RegExp Literal (Execution) 69.3±5.95µs 71.5±3.97µs -3.08%
RegExp Literal (Full) 354.2±17.40µs 324.4±12.87µs +9.19%
RegExp Literal Creation (Execution) 66.6±6.95µs 67.5±4.75µs -1.33%
RegExp Literal Creation (Full) 334.9±17.53µs 337.2±17.48µs -0.68%
Static Object Property Access (Execution) 4.9±0.19µs 4.7±0.20µs +4.26%
Static Object Property Access (Full) 252.7±14.14µs 272.9±9.12µs -7.40%
String Object Access (Execution) 6.7±0.34µs 7.1±0.23µs -5.63%
String Object Access (Full) 244.0±15.12µs 262.5±20.33µs -7.05%
String comparison (Execution) 6.6±0.29µs 6.1±0.29µs +8.20%
String comparison (Full) 254.1±17.61µs 253.8±11.69µs +0.12%
String concatenation (Execution) 5.4±0.36µs 5.0±0.33µs +8.00%
String concatenation (Full) 233.2±9.08µs 242.6±8.72µs -3.87%
String copy (Execution) 4.0±0.18µs 3.8±0.19µs +5.26%
String copy (Full) 228.7±12.11µs 251.9±16.18µs -9.21%
Symbols (Execution) 3.4±0.17µs 3.2±0.14µs +6.25%
Symbols (Full) 225.6±12.44µs 240.7±14.66µs -6.27%

@github-actions
Copy link

github-actions bot commented Oct 2, 2020

Benchmark for fd04f3d

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 322.6±9.50ns 323.6±9.68ns -0.31%
Arithmetic operations (Full) 217.8±6.23µs 241.1±6.76µs -9.66%
Array access (Execution) 7.5±0.44µs 7.5±0.32µs 0.00%
Array access (Full) 242.5±5.65µs 256.1±16.67µs -5.31%
Array creation (Execution) 2.9±0.07ms 2.8±0.08ms +3.57%
Array creation (Full) 3.0±0.06ms 3.1±0.07ms -3.23%
Array pop (Execution) 1019.1±24.77µs 965.4±25.86µs +5.56%
Array pop (Full) 1378.9±22.78µs 1471.5±47.88µs -6.29%
Boolean Object Access (Execution) 4.5±0.17µs 4.4±0.21µs +2.27%
Boolean Object Access (Full) 233.0±6.07µs 244.1±10.28µs -4.55%
Clean js (Execution) 678.9±29.62µs 660.9±38.91µs +2.72%
Clean js (Full) 916.1±24.58µs 945.4±23.92µs -3.10%
Clean js (Parser) 33.3±1.49µs 33.2±1.31µs +0.30%
Create Realm 418.2±12.22ns 426.5±14.66ns -1.95%
Dynamic Object Property Access (Execution) 5.3±0.31µs 4.9±0.18µs +8.16%
Dynamic Object Property Access (Full) 238.2±9.02µs 243.5±6.05µs -2.18%
Expression (Parser) 6.0±0.16µs 6.0±0.15µs 0.00%
Fibonacci (Execution) 809.0±20.43µs 788.6±21.19µs +2.59%
Fibonacci (Full) 1048.6±27.32µs 1077.8±93.02µs -2.71%
For loop (Execution) 22.4±0.36µs 20.4±0.69µs +9.80%
For loop (Full) 254.8±7.47µs 269.4±8.71µs -5.42%
For loop (Parser) 16.2±0.52µs 16.1±0.51µs +0.62%
Goal Symbols (Parser) 10.8±0.27µs 10.8±0.41µs 0.00%
Hello World (Parser) 2.8±0.08µs 2.8±0.07µs 0.00%
Long file (Parser) 717.0±31.51ns 709.5±31.87ns +1.06%
Mini js (Execution) 606.3±20.69µs 601.9±28.02µs +0.73%
Mini js (Full) 853.7±37.72µs 862.7±21.83µs -1.04%
Mini js (Parser) 29.1±1.02µs 29.4±1.27µs -1.02%
Number Object Access (Execution) 3.5±0.11µs 3.4±0.12µs +2.94%
Number Object Access (Full) 227.9±9.98µs 246.0±10.00µs -7.36%
Object Creation (Execution) 4.5±0.18µs 4.3±0.31µs +4.65%
Object Creation (Full) 233.3±9.23µs 241.9±5.72µs -3.56%
RegExp (Execution) 61.6±2.41µs 61.0±2.43µs +0.98%
RegExp (Full) 311.4±9.45µs 320.2±13.49µs -2.75%
RegExp Literal (Execution) 64.1±1.75µs 65.2±2.57µs -1.69%
RegExp Literal (Full) 304.8±9.31µs 313.4±8.75µs -2.74%
RegExp Literal Creation (Execution) 62.3±1.93µs 62.3±2.51µs 0.00%
RegExp Literal Creation (Full) 306.8±7.82µs 313.2±12.14µs -2.04%
Static Object Property Access (Execution) 4.6±0.14µs 4.5±0.20µs +2.22%
Static Object Property Access (Full) 235.7±26.39µs 244.1±6.96µs -3.44%
String Object Access (Execution) 6.4±0.18µs 6.3±0.17µs +1.59%
String Object Access (Full) 236.2±9.91µs 248.6±8.95µs -4.99%
String comparison (Execution) 6.5±0.27µs 5.9±0.16µs +10.17%
String comparison (Full) 246.7±19.90µs 250.3±14.02µs -1.44%
String concatenation (Execution) 5.1±0.10µs 4.8±0.11µs +6.25%
String concatenation (Full) 227.5±7.90µs 248.7±27.08µs -8.52%
String copy (Execution) 3.8±0.17µs 3.6±0.12µs +5.56%
String copy (Full) 228.9±8.74µs 239.5±11.25µs -4.43%
Symbols (Execution) 3.2±0.15µs 2.9±0.12µs +10.34%
Symbols (Full) 209.8±7.87µs 216.5±5.53µs -3.09%

@HalidOdat
Copy link
Member Author

HalidOdat commented Oct 2, 2020

This is ready for review/merge :)

Created some issues to track what has been fixed/improved, and looking at how many there are... maybe I put too much in this PR 😅

Copy link
Contributor

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

There are some typos and a few things I didn't fully understand.

boa/src/builtins/mod.rs Outdated Show resolved Hide resolved
boa/src/object/internal_methods.rs Show resolved Hide resolved
boa/src/context.rs Outdated Show resolved Hide resolved
boa/src/class.rs Outdated Show resolved Hide resolved
boa/src/builtins/map/mod.rs Outdated Show resolved Hide resolved
boa/src/builtins/error/type.rs Outdated Show resolved Hide resolved
boa/src/builtins/error/syntax.rs Outdated Show resolved Hide resolved
boa/src/builtins/error/reference.rs Outdated Show resolved Hide resolved
@RageKnify RageKnify modified the milestones: v0.10.0, v0.11.0 Oct 2, 2020
@HalidOdat HalidOdat requested a review from RageKnify October 2, 2020 13:28
@github-actions
Copy link

github-actions bot commented Oct 2, 2020

Benchmark for 863c285

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 386.2±18.08ns 406.1±29.19ns -4.90%
Arithmetic operations (Full) 255.4±16.13µs 277.5±18.34µs -7.96%
Array access (Execution) 8.2±0.34µs 8.7±0.37µs -5.75%
Array access (Full) 281.7±16.94µs 293.4±24.61µs -3.99%
Array creation (Execution) 3.8±0.26ms 3.7±0.20ms +2.70%
Array creation (Full) 3.9±0.18ms 4.1±0.26ms -4.88%
Array pop (Execution) 1304.2±48.69µs 1317.9±46.43µs -1.04%
Array pop (Full) 1743.8±87.97µs 1817.2±108.71µs -4.04%
Boolean Object Access (Execution) 5.1±0.19µs 5.1±0.14µs 0.00%
Boolean Object Access (Full) 274.3±14.89µs 286.6±16.43µs -4.29%
Clean js (Execution) 811.0±43.59µs 806.1±56.19µs +0.61%
Clean js (Full) 1139.7±167.59µs 1164.9±66.74µs -2.16%
Clean js (Parser) 38.3±3.20µs 37.5±2.49µs +2.13%
Create Realm 498.0±28.29ns 519.0±45.69ns -4.05%
Dynamic Object Property Access (Execution) 5.8±0.39µs 5.8±0.39µs 0.00%
Dynamic Object Property Access (Full) 272.3±18.59µs 282.4±26.16µs -3.58%
Expression (Parser) 7.2±0.30µs 7.2±0.37µs 0.00%
Fibonacci (Execution) 900.8±53.35µs 863.3±44.66µs +4.34%
Fibonacci (Full) 1140.8±84.20µs 1170.8±56.49µs -2.56%
For loop (Execution) 25.4±2.53µs 23.7±1.10µs +7.17%
For loop (Full) 289.7±12.87µs 308.5±17.43µs -6.09%
For loop (Parser) 19.0±0.87µs 18.3±0.65µs +3.83%
Goal Symbols (Parser) 12.4±0.42µs 13.5±1.03µs -8.15%
Hello World (Parser) 3.2±0.12µs 3.2±0.15µs 0.00%
Long file (Parser) 846.7±93.37ns 829.0±53.73ns +2.14%
Mini js (Execution) 716.9±31.50µs 736.3±45.06µs -2.63%
Mini js (Full) 1006.8±42.91µs 1065.6±175.49µs -5.52%
Mini js (Parser) 34.0±2.45µs 34.0±1.70µs 0.00%
Number Object Access (Execution) 4.2±0.29µs 3.9±0.17µs +7.69%
Number Object Access (Full) 259.9±16.40µs 289.5±23.72µs -10.22%
Object Creation (Execution) 4.9±0.17µs 5.0±0.38µs -2.00%
Object Creation (Full) 284.6±23.64µs 289.1±21.96µs -1.56%
RegExp (Execution) 69.5±4.55µs 71.6±6.20µs -2.93%
RegExp (Full) 370.8±29.46µs 365.0±15.77µs +1.59%
RegExp Literal (Execution) 72.7±3.79µs 74.3±5.13µs -2.15%
RegExp Literal (Full) 361.4±27.24µs 366.4±26.37µs -1.36%
RegExp Literal Creation (Execution) 72.4±4.70µs 69.0±3.56µs +4.93%
RegExp Literal Creation (Full) 348.8±44.41µs 356.5±17.74µs -2.16%
Static Object Property Access (Execution) 5.4±0.33µs 5.3±0.26µs +1.89%
Static Object Property Access (Full) 285.1±42.31µs 282.4±21.02µs +0.96%
String Object Access (Execution) 7.5±0.46µs 7.5±0.29µs 0.00%
String Object Access (Full) 273.8±20.03µs 295.2±27.63µs -7.25%
String comparison (Execution) 7.2±0.96µs 6.6±0.26µs +9.09%
String comparison (Full) 305.1±30.67µs 292.5±16.31µs +4.31%
String concatenation (Execution) 5.4±0.17µs 5.5±0.25µs -1.82%
String concatenation (Full) 265.0±13.33µs 304.5±28.32µs -12.97%
String copy (Execution) 4.1±0.28µs 4.1±0.21µs 0.00%
String copy (Full) 252.3±11.22µs 298.5±39.51µs -15.48%
Symbols (Execution) 3.4±0.17µs 3.5±0.23µs -2.86%
Symbols (Full) 250.8±21.13µs 248.3±11.16µs +1.01%

@JohnDoneth
Copy link
Contributor

I like the switch to builders instead of calling make_builtin_fn and like functions a bunch. Code is clear and concise! 👍

- Add BuiltIn trait
- Add ConstructorBuilder
- Add ObjectInitializer
- Cache core standard objects
- More efficient ConstructorBuilder::build()
- Allow to specify which prototype to inherit
- Refactor object property insertion
- Made ClassBuilder use ConstructorBuilder
- Make ConstructorBuilder::build() return GcObject
- Implement Debug for ClassBuilder and ConstructorBuilder
- Make ClassBuilder methods return &mut Self
- Make ObjectBuilder::build() return a GcObject
- Fixed global objects/properies attributes
- Fixed function prototype and attributes
- doc cached standard objects
- Set error object types to inherit from `Error.prototype`
- Added FunctionBuilder
- Add #[inline]
@github-actions
Copy link

github-actions bot commented Oct 3, 2020

Benchmark for e1fd1e4

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 359.2±9.73ns 344.2±16.18ns +4.36%
Arithmetic operations (Full) 241.7±8.37µs 261.3±6.19µs -7.50%
Array access (Execution) 7.5±0.28µs 7.6±0.31µs -1.32%
Array access (Full) 265.2±6.08µs 273.9±7.25µs -3.18%
Array creation (Execution) 3.2±0.09ms 3.2±0.11ms 0.00%
Array creation (Full) 3.6±0.05ms 3.6±0.08ms 0.00%
Array pop (Execution) 1149.7±41.13µs 1151.6±34.78µs -0.16%
Array pop (Full) 1662.1±29.68µs 1628.4±45.93µs +2.07%
Boolean Object Access (Execution) 4.7±0.12µs 4.6±0.14µs +2.17%
Boolean Object Access (Full) 252.7±7.69µs 268.6±5.27µs -5.92%
Clean js (Execution) 731.7±12.84µs 698.5±19.63µs +4.75%
Clean js (Full) 995.1±30.07µs 1019.7±21.44µs -2.41%
Clean js (Parser) 34.2±1.30µs 35.2±0.52µs -2.84%
Create Realm 448.7±7.87ns 455.4±6.91ns -1.47%
Dynamic Object Property Access (Execution) 5.2±0.14µs 5.2±0.15µs 0.00%
Dynamic Object Property Access (Full) 265.0±3.14µs 270.6±8.93µs -2.07%
Expression (Parser) 6.5±0.21µs 6.5±0.17µs 0.00%
Fibonacci (Execution) 779.0±25.18µs 763.2±22.46µs +2.07%
Fibonacci (Full) 1100.0±23.18µs 1054.4±25.59µs +4.32%
For loop (Execution) 21.1±0.64µs 20.4±0.81µs +3.43%
For loop (Full) 279.0±7.94µs 281.4±8.62µs -0.85%
For loop (Parser) 16.7±0.39µs 16.7±0.31µs 0.00%
Goal Symbols (Parser) 11.6±0.30µs 11.7±0.29µs -0.85%
Hello World (Parser) 2.9±0.06µs 3.0±0.06µs -3.33%
Long file (Parser) 745.3±20.17ns 737.6±18.59ns +1.04%
Mini js (Execution) 653.0±16.02µs 634.5±14.90µs +2.92%
Mini js (Full) 916.6±28.78µs 1077.2±175.63µs -14.91%
Mini js (Parser) 30.7±0.61µs 30.4±0.58µs +0.99%
Number Object Access (Execution) 3.8±0.08µs 3.7±0.10µs +2.70%
Number Object Access (Full) 256.4±5.36µs 269.5±7.35µs -4.86%
Object Creation (Execution) 4.5±0.13µs 4.5±0.07µs 0.00%
Object Creation (Full) 260.5±2.63µs 274.8±4.39µs -5.20%
RegExp (Execution) 61.8±1.78µs 61.1±1.97µs +1.15%
RegExp (Full) 342.1±4.10µs 349.4±10.34µs -2.09%
RegExp Literal (Execution) 64.5±2.06µs 66.5±2.04µs -3.01%
RegExp Literal (Full) 340.5±6.57µs 354.1±6.74µs -3.84%
RegExp Literal Creation (Execution) 63.0±1.87µs 60.7±2.10µs +3.79%
RegExp Literal Creation (Full) 327.4±6.46µs 327.9±8.61µs -0.15%
Static Object Property Access (Execution) 4.6±0.17µs 4.7±0.13µs -2.13%
Static Object Property Access (Full) 262.7±5.25µs 265.7±6.19µs -1.13%
String Object Access (Execution) 6.7±0.23µs 6.8±0.16µs -1.47%
String Object Access (Full) 262.1±6.72µs 275.2±5.59µs -4.76%
String comparison (Execution) 6.3±0.08µs 6.1±0.12µs +3.28%
String comparison (Full) 255.2±6.91µs 266.6±6.47µs -4.28%
String concatenation (Execution) 5.0±0.13µs 5.0±0.16µs 0.00%
String concatenation (Full) 251.8±6.30µs 266.7±6.88µs -5.59%
String copy (Execution) 3.8±0.08µs 3.7±0.10µs +2.70%
String copy (Full) 247.3±5.52µs 261.3±6.61µs -5.36%
Symbols (Execution) 3.1±0.13µs 3.0±0.09µs +3.33%
Symbols (Full) 243.4±5.36µs 253.7±7.52µs -4.06%

@github-actions
Copy link

github-actions bot commented Oct 3, 2020

Benchmark for f720978

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 367.0±20.51ns 421.5±66.58ns -12.93%
Arithmetic operations (Full) 291.5±17.42µs 314.1±34.88µs -7.20%
Array access (Execution) 8.5±0.61µs 9.3±0.57µs -8.60%
Array access (Full) 305.2±19.35µs 339.1±31.99µs -10.00%
Array creation (Execution) 3.3±0.19ms 3.5±0.27ms -5.71%
Array creation (Full) 3.5±0.24ms 3.9±0.34ms -10.26%
Array pop (Execution) 1165.2±103.40µs 1264.1±119.54µs -7.82%
Array pop (Full) 1578.4±96.63µs 1759.0±112.15µs -10.27%
Boolean Object Access (Execution) 5.2±0.30µs 5.8±0.54µs -10.34%
Boolean Object Access (Full) 305.4±19.19µs 320.9±31.47µs -4.83%
Clean js (Execution) 760.7±52.32µs 813.9±51.03µs -6.54%
Clean js (Full) 1121.3±55.52µs 1194.1±102.06µs -6.10%
Clean js (Parser) 43.3±3.57µs 40.1±1.95µs +7.98%
Create Realm 447.5±41.20ns 516.0±30.38ns -13.28%
Dynamic Object Property Access (Execution) 6.0±0.50µs 6.3±0.33µs -4.76%
Dynamic Object Property Access (Full) 292.7±17.38µs 319.1±41.81µs -8.27%
Expression (Parser) 8.1±0.86µs 7.6±0.72µs +6.58%
Fibonacci (Execution) 961.1±55.13µs 944.2±36.41µs +1.79%
Fibonacci (Full) 1284.5±65.90µs 1274.9±128.26µs +0.75%
For loop (Execution) 23.6±1.60µs 25.4±1.68µs -7.09%
For loop (Full) 322.7±20.79µs 336.2±26.96µs -4.02%
For loop (Parser) 21.8±2.21µs 18.9±1.07µs +15.34%
Goal Symbols (Parser) 13.1±0.85µs 13.0±0.94µs +0.77%
Hello World (Parser) 3.4±0.20µs 3.4±0.22µs 0.00%
Long file (Parser) 896.4±313.65ns 879.7±71.14ns +1.90%
Mini js (Execution) 663.3±34.30µs 748.0±38.04µs -11.32%
Mini js (Full) 1045.7±90.25µs 1123.7±81.98µs -6.94%
Mini js (Parser) 37.4±2.75µs 37.3±2.76µs +0.27%
Number Object Access (Execution) 4.2±0.24µs 4.4±0.27µs -4.55%
Number Object Access (Full) 300.7±20.81µs 305.2±21.12µs -1.47%
Object Creation (Execution) 5.4±0.43µs 5.4±0.80µs 0.00%
Object Creation (Full) 291.7±20.19µs 305.9±18.52µs -4.64%
RegExp (Execution) 70.3±5.01µs 72.9±6.48µs -3.57%
RegExp (Full) 391.6±28.25µs 414.9±44.50µs -5.62%
RegExp Literal (Execution) 78.0±5.19µs 83.4±13.97µs -6.47%
RegExp Literal (Full) 376.5±29.76µs 423.1±58.69µs -11.01%
RegExp Literal Creation (Execution) 73.0±6.13µs 76.7±6.42µs -4.82%
RegExp Literal Creation (Full) 369.7±16.81µs 409.3±34.78µs -9.68%
Static Object Property Access (Execution) 5.5±0.40µs 6.0±0.47µs -8.33%
Static Object Property Access (Full) 290.1±25.43µs 314.5±31.39µs -7.76%
String Object Access (Execution) 7.5±0.58µs 8.0±0.63µs -6.25%
String Object Access (Full) 298.2±22.04µs 315.2±22.98µs -5.39%
String comparison (Execution) 6.9±0.51µs 7.4±0.44µs -6.76%
String comparison (Full) 312.1±27.17µs 332.6±31.10µs -6.16%
String concatenation (Execution) 5.8±0.46µs 6.2±0.37µs -6.45%
String concatenation (Full) 304.1±19.75µs 327.7±36.31µs -7.20%
String copy (Execution) 4.4±0.26µs 4.6±0.33µs -4.35%
String copy (Full) 287.0±26.74µs 324.2±37.82µs -11.47%
Symbols (Execution) 3.5±0.24µs 3.8±0.25µs -7.89%
Symbols (Full) 286.0±23.17µs 303.0±19.97µs -5.61%

@HalidOdat HalidOdat merged commit eb1fd28 into master Oct 3, 2020
@HalidOdat HalidOdat deleted the refactor/builtins branch October 3, 2020 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request execution Issues or PRs related to code execution performance Performance related changes and issues technical debt
Projects
None yet
4 participants