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

Refactor PropertyDescriptor #794

Merged
merged 6 commits into from
Oct 8, 2020
Merged

Refactor PropertyDescriptor #794

merged 6 commits into from
Oct 8, 2020

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Oct 5, 2020

This PR adds a nice API for creating Property Descriptor (DataDescriptor and AccessorDescriptor) by making illegal state unrepresentable, for example get and value in the same property descriptor (which is not allowed, but was possible with the old implementation), which we needed dynamic checks to prove that it was not the case (performance penalty), but now we leverage the Type System for this as well as it makes implementing #591 and accessors so much easier.

It changes the following:

  • Rename Property => PropertyDescriptor
  • Add DataDescriptor for defining data descriptors
  • Add AccessorDescriptor for defining accessor descriptors
  • Make PropertyDescriptor an enum
  • Remove HAS_* form Attribute
  • Remove Value::update_property related to Decouple Object from Value #577

@HalidOdat HalidOdat added enhancement New feature or request technical debt API labels Oct 5, 2020
@HalidOdat HalidOdat added this to the v0.11.0 milestone Oct 5, 2020
@codecov
Copy link

codecov bot commented Oct 5, 2020

Codecov Report

Merging #794 into master will decrease coverage by 0.14%.
The diff coverage is 53.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #794      +/-   ##
==========================================
- Coverage   59.68%   59.54%   -0.15%     
==========================================
  Files         157      157              
  Lines       10054    10034      -20     
==========================================
- Hits         6001     5975      -26     
- Misses       4053     4059       +6     
Impacted Files Coverage Δ
boa/src/builtins/map/mod.rs 77.86% <0.00%> (-0.82%) ⬇️
boa/src/builtins/string/string_iterator.rs 77.50% <0.00%> (ø)
boa/src/context.rs 68.01% <0.00%> (ø)
boa/src/environment/global_environment_record.rs 27.95% <0.00%> (ø)
boa/src/object/iter.rs 21.21% <ø> (ø)
boa/src/property/attribute/mod.rs 86.95% <ø> (-3.67%) ⬇️
boa/src/value/display.rs 88.63% <ø> (ø)
boa/src/property/mod.rs 50.38% <40.32%> (-10.46%) ⬇️
boa/src/object/internal_methods.rs 55.90% <49.29%> (+0.55%) ⬆️
boa/src/builtins/array/mod.rs 73.52% <50.00%> (-0.21%) ⬇️
... and 12 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 ae76501...760e0f4. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Oct 5, 2020

Benchmark for be7d439

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 362.9±15.99ns 362.5±22.65ns +0.11%
Arithmetic operations (Full) 277.3±14.28µs 262.2±12.62µs +5.76%
Array access (Execution) 8.3±0.39µs 8.3±0.35µs 0.00%
Array access (Full) 314.2±13.77µs 302.2±9.96µs +3.97%
Array creation (Execution) 3.1±0.13ms 3.2±0.13ms -3.13%
Array creation (Full) 3.6±0.18ms 3.6±0.14ms 0.00%
Array pop (Execution) 1112.3±47.50µs 1109.6±75.03µs +0.24%
Array pop (Full) 1644.8±54.89µs 1651.7±59.93µs -0.42%
Boolean Object Access (Execution) 4.8±0.21µs 5.2±0.21µs -7.69%
Boolean Object Access (Full) 292.9±23.54µs 284.2±14.31µs +3.06%
Clean js (Execution) 739.8±33.06µs 739.3±27.77µs +0.07%
Clean js (Full) 1076.4±78.09µs 1058.9±48.98µs +1.65%
Clean js (Parser) 37.7±3.09µs 37.2±3.36µs +1.34%
Create Realm 470.5±39.43ns 478.1±39.21ns -1.59%
Dynamic Object Property Access (Execution) 6.0±0.27µs 5.8±0.31µs +3.45%
Dynamic Object Property Access (Full) 301.3±20.20µs 285.2±14.11µs +5.65%
Expression (Parser) 7.1±0.38µs 6.9±0.24µs +2.90%
Fibonacci (Execution) 941.3±44.14µs 912.2±32.85µs +3.19%
Fibonacci (Full) 1244.2±55.98µs 1255.3±43.42µs -0.88%
For loop (Execution) 24.0±1.64µs 23.1±1.45µs +3.90%
For loop (Full) 322.6±15.03µs 308.1±12.00µs +4.71%
For loop (Parser) 18.1±1.37µs 17.6±0.62µs +2.84%
Goal Symbols (Parser) 12.2±0.69µs 12.2±0.57µs 0.00%
Hello World (Parser) 3.2±0.14µs 3.3±0.47µs -3.03%
Long file (Parser) 796.0±30.15ns 805.5±36.00ns -1.18%
Mini js (Execution) 671.6±41.67µs 671.4±30.55µs +0.03%
Mini js (Full) 988.7±33.58µs 982.1±59.57µs +0.67%
Mini js (Parser) 33.1±0.99µs 32.5±1.34µs +1.85%
Number Object Access (Execution) 3.9±0.35µs 4.1±0.16µs -4.88%
Number Object Access (Full) 287.1±14.03µs 278.4±11.13µs +3.13%
Object Creation (Execution) 5.2±0.54µs 5.0±0.23µs +4.00%
Object Creation (Full) 296.9±13.34µs 283.6±12.23µs +4.69%
RegExp (Execution) 70.9±4.52µs 70.5±5.20µs +0.57%
RegExp (Full) 396.9±21.59µs 372.4±15.74µs +6.58%
RegExp Literal (Execution) 73.2±3.86µs 73.5±3.59µs -0.41%
RegExp Literal (Full) 390.2±13.75µs 373.4±25.34µs +4.50%
RegExp Literal Creation (Execution) 69.4±3.75µs 69.5±3.06µs -0.14%
RegExp Literal Creation (Full) 387.1±23.29µs 360.6±17.85µs +7.35%
Static Object Property Access (Execution) 5.4±0.19µs 5.3±0.36µs +1.89%
Static Object Property Access (Full) 293.5±17.88µs 285.0±17.03µs +2.98%
String Object Access (Execution) 7.3±0.32µs 7.3±0.58µs 0.00%
String Object Access (Full) 302.9±12.43µs 284.4±11.17µs +6.50%
String comparison (Execution) 6.7±0.26µs 6.7±0.31µs 0.00%
String comparison (Full) 299.4±11.35µs 288.4±15.59µs +3.81%
String concatenation (Execution) 5.6±0.22µs 5.6±0.31µs 0.00%
String concatenation (Full) 302.1±15.68µs 278.2±18.24µs +8.59%
String copy (Execution) 4.2±0.19µs 4.2±0.23µs 0.00%
String copy (Full) 290.6±9.42µs 278.5±15.80µs +4.34%
Symbols (Execution) 3.5±0.33µs 3.6±0.15µs -2.78%
Symbols (Full) 284.8±16.01µs 272.0±14.20µs +4.71%

@github-actions
Copy link

github-actions bot commented Oct 5, 2020

Benchmark for f713b54

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 405.7±13.69ns 399.7±13.97ns +1.50%
Arithmetic operations (Full) 302.1±9.30µs 294.8±13.49µs +2.48%
Array access (Execution) 9.1±0.30µs 9.3±0.59µs -2.15%
Array access (Full) 332.9±26.89µs 321.9±13.63µs +3.42%
Array creation (Execution) 3.5±0.13ms 3.5±0.16ms 0.00%
Array creation (Full) 3.7±0.14ms 3.9±0.17ms -5.13%
Array pop (Execution) 1223.8±35.66µs 1203.2±59.05µs +1.71%
Array pop (Full) 1737.8±50.09µs 1827.6±123.59µs -4.91%
Boolean Object Access (Execution) 5.4±0.33µs 5.8±0.46µs -6.90%
Boolean Object Access (Full) 319.4±20.66µs 320.1±9.21µs -0.22%
Clean js (Execution) 843.7±39.68µs 812.9±22.13µs +3.79%
Clean js (Full) 1180.0±55.30µs 1150.5±37.82µs +2.56%
Clean js (Parser) 40.7±1.51µs 40.9±2.43µs -0.49%
Create Realm 529.5±51.59ns 508.4±12.44ns +4.15%
Dynamic Object Property Access (Execution) 6.4±0.19µs 6.5±0.31µs -1.54%
Dynamic Object Property Access (Full) 328.7±21.77µs 314.3±13.94µs +4.58%
Expression (Parser) 7.7±0.29µs 7.4±0.46µs +4.05%
Fibonacci (Execution) 1020.6±36.55µs 1003.0±31.04µs +1.75%
Fibonacci (Full) 1368.6±37.76µs 1360.0±47.85µs +0.63%
For loop (Execution) 25.7±1.70µs 26.9±0.88µs -4.46%
For loop (Full) 347.8±15.02µs 343.3±16.49µs +1.31%
For loop (Parser) 19.6±0.82µs 19.4±0.86µs +1.03%
Goal Symbols (Parser) 13.5±0.84µs 13.4±0.52µs +0.75%
Hello World (Parser) 3.5±0.12µs 3.4±0.12µs +2.94%
Long file (Parser) 869.2±78.34ns 850.3±39.97ns +2.22%
Mini js (Execution) 747.5±44.34µs 727.8±22.94µs +2.71%
Mini js (Full) 1067.3±44.14µs 1054.2±49.02µs +1.24%
Mini js (Parser) 35.7±1.14µs 35.8±1.25µs -0.28%
Number Object Access (Execution) 4.2±0.10µs 4.6±0.16µs -8.70%
Number Object Access (Full) 314.0±11.81µs 305.8±11.98µs +2.68%
Object Creation (Execution) 5.6±0.30µs 5.5±0.26µs +1.82%
Object Creation (Full) 326.1±27.41µs 311.0±12.12µs +4.86%
RegExp (Execution) 76.7±3.70µs 76.3±3.33µs +0.52%
RegExp (Full) 405.0±16.10µs 406.3±28.37µs -0.32%
RegExp Literal (Execution) 79.9±3.51µs 80.7±3.47µs -0.99%
RegExp Literal (Full) 402.5±17.59µs 403.9±15.42µs -0.35%
RegExp Literal Creation (Execution) 78.3±8.44µs 76.0±3.09µs +3.03%
RegExp Literal Creation (Full) 404.3±19.44µs 393.8±11.19µs +2.67%
Static Object Property Access (Execution) 5.8±0.23µs 5.9±0.27µs -1.69%
Static Object Property Access (Full) 316.1±11.08µs 308.7±14.38µs +2.40%
String Object Access (Execution) 7.9±0.41µs 8.3±0.28µs -4.82%
String Object Access (Full) 321.8±17.15µs 313.8±14.23µs +2.55%
String comparison (Execution) 7.3±0.22µs 7.3±0.47µs 0.00%
String comparison (Full) 319.6±12.69µs 316.3±11.67µs +1.04%
String concatenation (Execution) 6.1±0.34µs 6.1±0.34µs 0.00%
String concatenation (Full) 330.4±16.22µs 305.3±13.08µs +8.22%
String copy (Execution) 4.7±0.19µs 4.7±0.22µs 0.00%
String copy (Full) 302.2±7.55µs 304.2±15.84µs -0.66%
Symbols (Execution) 3.9±0.18µs 3.9±0.14µs 0.00%
Symbols (Full) 304.3±12.58µs 298.5±17.11µs +1.94%

@HalidOdat HalidOdat force-pushed the refactor/property-descriptor branch 5 times, most recently from d9455d4 to 634d624 Compare October 7, 2020 08:16
@github-actions
Copy link

github-actions bot commented Oct 7, 2020

Benchmark for 719e34f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 403.6±33.35ns 400.1±23.73ns +0.87%
Arithmetic operations (Full) 282.4±27.52µs 273.2±24.02µs +3.37%
Array access (Execution) 9.1±0.58µs 8.9±0.55µs +2.25%
Array access (Full) 322.3±29.92µs 303.9±21.33µs +6.05%
Array creation (Execution) 3.3±0.17ms 3.5±0.20ms -5.71%
Array creation (Full) 3.9±0.21ms 3.8±0.19ms +2.63%
Array pop (Execution) 1194.5±69.31µs 1235.5±56.24µs -3.32%
Array pop (Full) 1794.5±100.96µs 1742.6±82.66µs +2.98%
Boolean Object Access (Execution) 5.3±0.32µs 5.4±0.41µs -1.85%
Boolean Object Access (Full) 289.7±13.34µs 292.3±25.22µs -0.89%
Clean js (Execution) 821.2±54.71µs 836.5±54.84µs -1.83%
Clean js (Full) 1165.7±69.80µs 1132.5±69.21µs +2.93%
Clean js (Parser) 42.5±3.02µs 39.8±2.38µs +6.78%
Create Realm 505.9±28.02ns 496.1±26.43ns +1.98%
Dynamic Object Property Access (Execution) 6.3±0.36µs 6.1±0.28µs +3.28%
Dynamic Object Property Access (Full) 305.0±20.99µs 292.0±16.21µs +4.45%
Expression (Parser) 7.5±0.39µs 7.5±0.34µs 0.00%
Fibonacci (Execution) 987.8±52.94µs 984.8±56.86µs +0.30%
Fibonacci (Full) 1338.8±80.57µs 1259.9±84.90µs +6.26%
For loop (Execution) 25.2±1.47µs 24.9±1.38µs +1.20%
For loop (Full) 346.6±24.71µs 322.0±26.83µs +7.64%
For loop (Parser) 20.3±1.56µs 19.4±0.98µs +4.64%
Goal Symbols (Parser) 13.6±0.72µs 13.6±1.15µs 0.00%
Hello World (Parser) 3.5±0.19µs 3.5±0.19µs 0.00%
Long file (Parser) 861.7±50.07ns 864.0±54.90ns -0.27%
Mini js (Execution) 703.6±45.44µs 735.3±50.87µs -4.31%
Mini js (Full) 1044.8±63.67µs 1018.1±57.10µs +2.62%
Mini js (Parser) 37.1±3.85µs 36.8±2.43µs +0.82%
Number Object Access (Execution) 4.1±0.16µs 4.4±0.41µs -6.82%
Number Object Access (Full) 290.5±18.51µs 293.9±16.40µs -1.16%
Object Creation (Execution) 5.4±0.33µs 5.5±0.34µs -1.82%
Object Creation (Full) 301.3±17.12µs 289.8±20.84µs +3.97%
RegExp (Execution) 10.8±0.79µs 10.3±0.84µs +4.85%
RegExp (Full) 324.9±21.62µs 305.5±20.96µs +6.35%
RegExp Literal (Execution) 11.9±1.00µs 11.5±0.71µs +3.48%
RegExp Literal (Full) 314.6±26.79µs 308.7±21.43µs +1.91%
RegExp Literal Creation (Execution) 10.5±0.87µs 10.3±0.59µs +1.94%
RegExp Literal Creation (Full) 306.2±17.90µs 291.0±17.07µs +5.22%
Static Object Property Access (Execution) 5.6±0.34µs 5.5±0.36µs +1.82%
Static Object Property Access (Full) 292.2±18.14µs 296.0±14.15µs -1.28%
String Object Access (Execution) 7.7±0.62µs 7.7±0.42µs 0.00%
String Object Access (Full) 298.4±14.71µs 287.9±21.04µs +3.65%
String comparison (Execution) 7.3±0.48µs 7.1±0.39µs +2.82%
String comparison (Full) 305.7±19.36µs 290.5±14.74µs +5.23%
String concatenation (Execution) 5.9±0.47µs 5.7±0.41µs +3.51%
String concatenation (Full) 297.4±24.92µs 289.1±16.90µs +2.87%
String copy (Execution) 4.4±0.18µs 4.5±0.24µs -2.22%
String copy (Full) 284.8±16.89µs 277.2±13.89µs +2.74%
Symbols (Execution) 3.8±0.22µs 3.6±0.24µs +5.56%
Symbols (Full) 280.5±19.53µs 277.8±21.57µs +0.97%

@github-actions
Copy link

github-actions bot commented Oct 7, 2020

Benchmark for 7ce1a65

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 371.8±41.13ns 364.1±31.69ns +2.11%
Arithmetic operations (Full) 253.8±25.46µs 260.7±25.60µs -2.65%
Array access (Execution) 7.8±0.73µs 8.7±0.79µs -10.34%
Array access (Full) 288.2±29.34µs 294.9±26.83µs -2.27%
Array creation (Execution) 2.6±0.24ms 3.3±0.29ms -21.21%
Array creation (Full) 2.8±0.20ms 3.5±0.28ms -20.00%
Array pop (Execution) 942.2±74.80µs 1149.9±94.33µs -18.06%
Array pop (Full) 1455.3±127.32µs 1685.9±150.21µs -13.68%
Boolean Object Access (Execution) 4.4±0.40µs 4.9±0.37µs -10.20%
Boolean Object Access (Full) 279.7±27.98µs 269.6±23.71µs +3.75%
Clean js (Execution) 715.3±72.93µs 762.7±77.31µs -6.21%
Clean js (Full) 987.6±83.24µs 1084.6±100.93µs -8.94%
Clean js (Parser) 38.1±3.50µs 37.8±3.36µs +0.79%
Create Realm 456.2±37.80ns 480.9±44.01ns -5.14%
Dynamic Object Property Access (Execution) 5.8±0.58µs 6.0±0.58µs -3.33%
Dynamic Object Property Access (Full) 273.6±24.56µs 272.7±22.49µs +0.33%
Expression (Parser) 7.0±0.60µs 7.0±0.85µs 0.00%
Fibonacci (Execution) 890.1±66.86µs 895.0±58.39µs -0.55%
Fibonacci (Full) 1167.3±105.98µs 1189.7±106.89µs -1.88%
For loop (Execution) 22.9±2.24µs 24.2±2.31µs -5.37%
For loop (Full) 307.9±22.24µs 309.1±26.20µs -0.39%
For loop (Parser) 18.6±1.58µs 19.2±2.37µs -3.12%
Goal Symbols (Parser) 12.1±1.04µs 12.2±1.12µs -0.82%
Hello World (Parser) 3.2±0.27µs 3.1±0.20µs +3.23%
Long file (Parser) 784.5±68.88ns 814.9±90.34ns -3.73%
Mini js (Execution) 635.7±67.76µs 674.9±60.85µs -5.81%
Mini js (Full) 909.4±76.28µs 973.3±88.85µs -6.57%
Mini js (Parser) 34.3±3.88µs 33.4±2.57µs +2.69%
Number Object Access (Execution) 3.6±0.59µs 4.2±0.39µs -14.29%
Number Object Access (Full) 266.8±24.00µs 266.2±21.69µs +0.23%
Object Creation (Execution) 4.7±0.39µs 5.1±0.50µs -7.84%
Object Creation (Full) 267.5±23.68µs 285.9±28.68µs -6.44%
RegExp (Execution) 9.5±0.85µs 9.7±0.88µs -2.06%
RegExp (Full) 281.6±30.81µs 281.2±25.61µs +0.14%
RegExp Literal (Execution) 10.3±1.04µs 10.6±0.78µs -2.83%
RegExp Literal (Full) 270.5±20.92µs 278.2±23.71µs -2.77%
RegExp Literal Creation (Execution) 9.4±0.81µs 9.9±0.79µs -5.05%
RegExp Literal Creation (Full) 276.5±25.65µs 275.9±25.81µs +0.22%
Static Object Property Access (Execution) 5.2±1.17µs 5.5±0.54µs -5.45%
Static Object Property Access (Full) 269.1±25.12µs 280.2±36.38µs -3.96%
String Object Access (Execution) 6.4±0.60µs 7.1±0.61µs -9.86%
String Object Access (Full) 264.5±23.26µs 272.5±22.85µs -2.94%
String comparison (Execution) 6.4±0.63µs 6.7±0.60µs -4.48%
String comparison (Full) 276.7±31.65µs 283.2±30.43µs -2.30%
String concatenation (Execution) 5.1±0.35µs 5.4±0.45µs -5.56%
String concatenation (Full) 269.0±22.33µs 267.0±24.91µs +0.75%
String copy (Execution) 4.1±0.46µs 4.3±0.38µs -4.65%
String copy (Full) 264.7±24.63µs 257.2±20.86µs +2.92%
Symbols (Execution) 3.2±0.33µs 3.5±0.38µs -8.57%
Symbols (Full) 245.4±22.17µs 253.3±25.73µs -3.12%

@HalidOdat HalidOdat marked this pull request as ready for review October 7, 2020 16:49
@github-actions
Copy link

github-actions bot commented Oct 7, 2020

Benchmark for b0b3f3f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 339.0±15.79ns 344.2±12.31ns -1.51%
Arithmetic operations (Full) 238.7±12.42µs 247.7±14.81µs -3.63%
Array access (Execution) 7.5±0.47µs 7.8±0.35µs -3.85%
Array access (Full) 262.7±14.21µs 268.0±13.66µs -1.98%
Array creation (Execution) 2.5±0.11ms 3.2±0.20ms -21.88%
Array creation (Full) 2.7±0.10ms 3.3±0.11ms -18.18%
Array pop (Execution) 911.5±43.25µs 1125.9±72.23µs -19.04%
Array pop (Full) 1355.6±79.04µs 1530.6±66.94µs -11.43%
Boolean Object Access (Execution) 4.2±0.19µs 4.9±0.28µs -14.29%
Boolean Object Access (Full) 253.6±14.55µs 259.1±8.80µs -2.12%
Clean js (Execution) 655.7±31.10µs 706.9±27.60µs -7.24%
Clean js (Full) 958.1±41.90µs 996.4±43.17µs -3.84%
Clean js (Parser) 36.2±1.65µs 37.9±2.14µs -4.49%
Create Realm 464.3±30.60ns 452.5±23.99ns +2.61%
Dynamic Object Property Access (Execution) 5.3±0.23µs 5.5±0.28µs -3.64%
Dynamic Object Property Access (Full) 257.8±13.14µs 255.2±9.30µs +1.02%
Expression (Parser) 6.8±0.34µs 6.7±0.28µs +1.49%
Fibonacci (Execution) 822.6±26.15µs 858.5±29.05µs -4.18%
Fibonacci (Full) 1108.7±65.98µs 1133.9±69.44µs -2.22%
For loop (Execution) 21.4±0.94µs 22.2±1.08µs -3.60%
For loop (Full) 287.0±15.41µs 283.7±17.51µs +1.16%
For loop (Parser) 17.6±1.11µs 17.8±0.79µs -1.12%
Goal Symbols (Parser) 11.9±0.58µs 12.2±0.80µs -2.46%
Hello World (Parser) 3.1±0.16µs 3.2±0.15µs -3.13%
Long file (Parser) 758.2±33.41ns 755.6±29.20ns +0.34%
Mini js (Execution) 590.0±26.77µs 644.0±36.61µs -8.39%
Mini js (Full) 865.5±39.21µs 904.5±37.34µs -4.31%
Mini js (Parser) 31.6±1.43µs 33.1±1.97µs -4.53%
Number Object Access (Execution) 3.3±0.23µs 3.7±0.16µs -10.81%
Number Object Access (Full) 248.3±10.40µs 248.4±10.58µs -0.04%
Object Creation (Execution) 4.6±0.22µs 4.8±0.29µs -4.17%
Object Creation (Full) 252.2±19.13µs 255.2±18.30µs -1.18%
RegExp (Execution) 9.0±0.50µs 9.2±0.40µs -2.17%
RegExp (Full) 262.6±10.27µs 274.7±10.37µs -4.40%
RegExp Literal (Execution) 9.9±0.59µs 10.6±0.55µs -6.60%
RegExp Literal (Full) 264.0±12.39µs 267.8±27.24µs -1.42%
RegExp Literal Creation (Execution) 8.9±0.40µs 9.2±0.44µs -3.26%
RegExp Literal Creation (Full) 266.0±17.50µs 258.9±15.51µs +2.74%
Static Object Property Access (Execution) 4.7±0.26µs 5.0±0.34µs -6.00%
Static Object Property Access (Full) 258.3±19.16µs 252.4±9.82µs +2.34%
String Object Access (Execution) 6.3±0.29µs 6.9±0.36µs -8.70%
String Object Access (Full) 252.1±15.27µs 261.7±9.71µs -3.67%
String comparison (Execution) 6.1±0.34µs 6.2±0.24µs -1.61%
String comparison (Full) 264.3±10.60µs 256.0±12.38µs +3.24%
String concatenation (Execution) 5.0±0.28µs 5.1±0.21µs -1.96%
String concatenation (Full) 261.9±10.81µs 247.8±8.56µs +5.69%
String copy (Execution) 3.8±0.27µs 4.0±0.15µs -5.00%
String copy (Full) 248.6±10.68µs 256.0±15.57µs -2.89%
Symbols (Execution) 2.9±0.13µs 3.3±0.25µs -12.12%
Symbols (Full) 231.5±10.88µs 228.9±7.35µs +1.14%

@HalidOdat
Copy link
Member Author

HalidOdat commented Oct 7, 2020

Some benchmarks show a 20% increase in performance :)

boa/src/value/mod.rs Outdated Show resolved Hide resolved
boa/src/property/mod.rs Outdated Show resolved Hide resolved
boa/src/property/mod.rs Outdated Show resolved Hide resolved
@RageKnify
Copy link
Member

RageKnify commented Oct 7, 2020

You're leaving a lot of TODOs and FIXMEs related to AccessorDescriptors, to ease solving them I think you should create an issue and mention the issue number in those comments. That way when implementing we know what to search for.

@HalidOdat
Copy link
Member Author

HalidOdat commented Oct 7, 2020

You're leaving a lot of TODOs and FIXMEs related to AccessorDescriptors, to ease solving them.

My intention with this PR was not to fix the already present bugs (even though I did fix some), but to make them more visible, places where there were hard to identify bugs (like accessor not being called, properties being ignored when they shouldn't) now panic (with unwrap/expect) so its easier to know were there located, and are immediately known as bugs, instead of giving some weird behaviour.

I think you should create an issue and mention the issue number in those comments. That way when implementing we know what to search for.

Will create the issue once this has been merged :)

@github-actions
Copy link

github-actions bot commented Oct 7, 2020

Benchmark for fa3799a

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 324.0±13.81ns 322.0±8.81ns +0.62%
Arithmetic operations (Full) 227.1±7.45µs 237.0±10.60µs -4.18%
Array access (Execution) 7.0±0.23µs 7.5±0.25µs -6.67%
Array access (Full) 249.2±14.23µs 257.6±6.12µs -3.26%
Array creation (Execution) 2.4±0.09ms 3.0±0.15ms -20.00%
Array creation (Full) 2.8±0.07ms 3.1±0.06ms -9.68%
Array pop (Execution) 864.5±36.16µs 1046.2±40.22µs -17.37%
Array pop (Full) 1349.0±29.92µs 1473.4±41.10µs -8.44%
Boolean Object Access (Execution) 3.9±0.19µs 4.5±0.20µs -13.33%
Boolean Object Access (Full) 237.1±10.11µs 242.6±4.77µs -2.27%
Clean js (Execution) 618.8±15.66µs 697.6±20.48µs -11.30%
Clean js (Full) 907.0±29.46µs 954.4±47.19µs -4.97%
Clean js (Parser) 33.7±0.74µs 34.1±0.90µs -1.17%
Create Realm 413.5±13.05ns 423.1±13.04ns -2.27%
Dynamic Object Property Access (Execution) 5.1±0.20µs 5.3±0.27µs -3.77%
Dynamic Object Property Access (Full) 241.3±6.19µs 248.5±5.74µs -2.90%
Expression (Parser) 6.1±0.20µs 6.6±0.17µs -7.58%
Fibonacci (Execution) 779.8±23.35µs 820.4±18.00µs -4.95%
Fibonacci (Full) 1022.2±27.99µs 1067.3±34.59µs -4.23%
For loop (Execution) 20.5±0.61µs 20.9±0.40µs -1.91%
For loop (Full) 271.0±8.62µs 277.1±5.25µs -2.20%
For loop (Parser) 16.7±0.75µs 16.5±0.60µs +1.21%
Goal Symbols (Parser) 11.1±0.27µs 11.0±0.18µs +0.91%
Hello World (Parser) 2.9±0.12µs 2.9±0.13µs 0.00%
Long file (Parser) 713.0±26.17ns 710.4±14.16ns +0.37%
Mini js (Execution) 555.9±17.46µs 601.7±18.00µs -7.61%
Mini js (Full) 822.0±23.76µs 860.7±17.08µs -4.50%
Mini js (Parser) 29.9±1.27µs 30.3±1.27µs -1.32%
Number Object Access (Execution) 3.1±0.12µs 3.5±0.08µs -11.43%
Number Object Access (Full) 233.4±9.60µs 241.6±10.90µs -3.39%
Object Creation (Execution) 4.4±0.21µs 4.5±0.09µs -2.22%
Object Creation (Full) 238.1±6.35µs 246.0±7.10µs -3.21%
RegExp (Execution) 8.4±0.28µs 8.7±0.22µs -3.45%
RegExp (Full) 247.8±9.97µs 252.3±4.42µs -1.78%
RegExp Literal (Execution) 9.4±0.37µs 9.7±0.31µs -3.09%
RegExp Literal (Full) 247.5±11.25µs 254.4±14.58µs -2.71%
RegExp Literal Creation (Execution) 8.4±0.26µs 8.7±0.42µs -3.45%
RegExp Literal Creation (Full) 240.8±5.51µs 246.4±10.33µs -2.27%
Static Object Property Access (Execution) 4.5±0.12µs 4.6±0.09µs -2.17%
Static Object Property Access (Full) 241.3±10.42µs 246.6±7.09µs -2.15%
String Object Access (Execution) 5.8±0.25µs 6.4±0.12µs -9.38%
String Object Access (Full) 240.1±10.10µs 244.9±4.69µs -1.96%
String comparison (Execution) 5.6±0.13µs 5.9±0.17µs -5.08%
String comparison (Full) 239.1±5.24µs 250.5±5.97µs -4.55%
String concatenation (Execution) 4.7±0.12µs 4.8±0.12µs -2.08%
String concatenation (Full) 235.7±6.76µs 244.6±7.35µs -3.64%
String copy (Execution) 3.5±0.09µs 3.7±0.17µs -5.41%
String copy (Full) 233.6±7.95µs 243.9±13.14µs -4.22%
Symbols (Execution) 2.8±0.08µs 3.0±0.10µs -6.67%
Symbols (Full) 216.1±4.82µs 221.9±5.60µs -2.61%

boa/src/value/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

I love the new benchmarks. Check the comment by @RageKnify and see if a re-base fixes the tests, but for me it's good to go (also, I'm not super familiar with this, so take my review with a gran of salt) :)

Copy link
Member

@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.

Other than the allocation everything seems alright, I'd already reviwed everything yesterday and the last 2 commits didn't change all that much.

- Add DataDescriptor
- Add AccessorDescriptor
- Remove PropertyDescriptor::data_descriptor()
- Make AccessorDescriptor accessors GcObjects
- Make Object::get_own_property return a Option<PropertyDescriptor>
- Remove PropertyDescriptor::is_none()
- Remove PropertyDescriptor::empty()
- Removed PropertyDescriptor::value()
- Added spec complaint ToPropertyDescriptor (to_property_descriptor)
- Remove From<&PropertyDescriptor> for Value
@github-actions
Copy link

github-actions bot commented Oct 8, 2020

Benchmark for 023fcdb

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 373.6±14.93ns 375.0±16.59ns -0.37%
Arithmetic operations (Full) 263.3±9.00µs 262.4±6.18µs +0.34%
Array access (Execution) 8.2±0.29µs 8.5±0.38µs -3.53%
Array access (Full) 281.8±8.21µs 286.9±8.02µs -1.78%
Array creation (Execution) 2.7±0.09ms 3.4±0.11ms -20.59%
Array creation (Full) 3.2±0.13ms 3.5±0.16ms -8.57%
Array pop (Execution) 974.4±24.55µs 1199.1±48.76µs -18.74%
Array pop (Full) 1513.1±58.04µs 1608.2±53.98µs -5.91%
Boolean Object Access (Execution) 4.6±0.21µs 5.1±0.21µs -9.80%
Boolean Object Access (Full) 271.9±13.76µs 274.7±14.09µs -1.02%
Clean js (Execution) 702.3±23.68µs 774.6±25.14µs -9.33%
Clean js (Full) 1054.3±36.76µs 1072.1±48.39µs -1.66%
Clean js (Parser) 39.7±2.09µs 39.0±1.28µs +1.79%
Create Realm 534.5±33.16ns 487.7±34.12ns +9.60%
Dynamic Object Property Access (Execution) 5.8±0.28µs 6.0±0.33µs -3.33%
Dynamic Object Property Access (Full) 279.6±11.36µs 277.7±8.18µs +0.68%
Expression (Parser) 7.2±0.28µs 7.1±0.44µs +1.41%
Fibonacci (Execution) 894.5±23.64µs 925.3±33.01µs -3.33%
Fibonacci (Full) 1184.2±43.18µs 1222.6±50.43µs -3.14%
For loop (Execution) 22.9±1.42µs 24.1±1.25µs -4.98%
For loop (Full) 321.0±12.04µs 317.0±7.18µs +1.26%
For loop (Parser) 18.9±0.60µs 18.9±0.82µs 0.00%
Goal Symbols (Parser) 13.0±0.66µs 12.7±0.95µs +2.36%
Hello World (Parser) 3.4±0.16µs 3.3±0.16µs +3.03%
Long file (Parser) 838.5±37.64ns 828.4±23.13ns +1.22%
Mini js (Execution) 635.2±22.98µs 698.5±31.12µs -9.06%
Mini js (Full) 949.0±34.23µs 966.5±32.25µs -1.81%
Mini js (Parser) 34.5±1.48µs 34.2±1.24µs +0.88%
Number Object Access (Execution) 3.6±0.11µs 4.0±0.11µs -10.00%
Number Object Access (Full) 271.1±8.16µs 268.5±11.52µs +0.97%
Object Creation (Execution) 4.8±0.20µs 5.2±0.22µs -7.69%
Object Creation (Full) 270.7±6.91µs 272.4±9.14µs -0.62%
RegExp (Execution) 9.7±0.33µs 10.0±0.38µs -3.00%
RegExp (Full) 287.6±13.88µs 280.8±10.03µs +2.42%
RegExp Literal (Execution) 11.0±0.30µs 11.3±0.56µs -2.65%
RegExp Literal (Full) 280.1±9.35µs 278.5±7.06µs +0.57%
RegExp Literal Creation (Execution) 9.8±0.33µs 10.1±1.42µs -2.97%
RegExp Literal Creation (Full) 284.3±13.48µs 279.6±10.53µs +1.68%
Static Object Property Access (Execution) 5.0±0.12µs 5.3±0.11µs -5.66%
Static Object Property Access (Full) 274.1±10.49µs 273.1±7.23µs +0.37%
String Object Access (Execution) 6.8±0.33µs 7.4±0.22µs -8.11%
String Object Access (Full) 283.8±17.14µs 280.7±13.24µs +1.10%
String comparison (Execution) 6.6±0.61µs 6.8±0.26µs -2.94%
String comparison (Full) 277.1±13.12µs 281.8±8.68µs -1.67%
String concatenation (Execution) 5.3±0.48µs 6.1±0.24µs -13.11%
String concatenation (Full) 281.6±9.64µs 277.8±11.55µs +1.37%
String copy (Execution) 4.1±0.23µs 4.3±0.28µs -4.65%
String copy (Full) 264.6±7.78µs 269.4±8.18µs -1.78%
Symbols (Execution) 3.3±0.15µs 3.5±0.16µs -5.71%
Symbols (Full) 255.7±12.21µs 247.8±12.99µs +3.19%

@Razican Razican merged commit 470dbb4 into master Oct 8, 2020
@Razican Razican deleted the refactor/property-descriptor branch October 8, 2020 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants