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

Make environment methods take &mut Context #1131

Merged
merged 9 commits into from
May 10, 2021
Merged

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Feb 16, 2021

It changes the following:

  • Remove ErrorKind
  • Move LexicalEnvironment methods to Context
  • Make environment methods take &mut Context
  • Make environment methods return Result<T>
  • Make environment methods pub(crate)

@HalidOdat HalidOdat added technical debt execution Issues or PRs related to code execution labels Feb 16, 2021
@github-actions
Copy link

github-actions bot commented Feb 16, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,701 78,701 0
Passed 25,730 25,724 -6
Ignored 15,519 15,519 0
Failed 37,452 37,458 +6
Panics 12 27 +15
Conformance 32.69% 32.69% -0.01%

@HalidOdat HalidOdat force-pushed the fix/environments branch 2 times, most recently from 8de49b4 to 9c88f59 Compare February 17, 2021 00:04
@github-actions
Copy link

Benchmark for 3437d38

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 340.5±11.37ns 346.7±12.34ns -1.79%
Arithmetic operations (Full) 217.6±7.98µs 218.8±8.52µs -0.55%
Array access (Execution) 6.0±0.11µs 5.8±0.20µs +3.45%
Array access (Full) 234.1±10.30µs 255.4±1.92µs -8.34%
Array creation (Execution) 2.7±0.05ms 2.7±0.14ms 0.00%
Array creation (Full) 3.0±0.13ms 3.0±0.10ms 0.00%
Array pop (Execution) 887.3±18.35µs 901.0±29.71µs -1.52%
Array pop (Full) 1279.1±61.18µs 1375.1±46.83µs -6.98%
Boolean Object Access (Execution) 4.8±0.19µs 4.8±0.18µs 0.00%
Boolean Object Access (Full) 230.6±11.42µs 235.3±9.97µs -2.00%
Clean js (Execution) 618.3±25.75µs 651.8±19.11µs -5.14%
Clean js (Full) 877.6±38.73µs 933.7±30.75µs -6.01%
Clean js (Parser) 41.0±0.91µs 40.3±1.78µs +1.74%
Create Realm 454.3±8.33ns 424.2±16.28ns +7.10%
Dynamic Object Property Access (Execution) 4.6±0.19µs 4.8±0.16µs -4.17%
Dynamic Object Property Access (Full) 226.3±7.76µs 240.2±15.02µs -5.79%
Expression (Parser) 6.7±0.20µs 6.6±0.28µs +1.52%
Fibonacci (Execution) 803.2±21.22µs 807.2±19.83µs -0.50%
Fibonacci (Full) 1027.6±52.25µs 1135.2±2.40µs -9.48%
For loop (Execution) 22.1±0.45µs 21.4±0.71µs +3.27%
For loop (Full) 260.2±12.25µs 275.9±0.62µs -5.69%
For loop (Parser) 18.9±0.64µs 19.5±0.97µs -3.08%
Goal Symbols (Parser) 13.4±0.43µs 13.7±0.58µs -2.19%
Hello World (Parser) 3.6±0.12µs 3.7±0.13µs -2.70%
Long file (Parser) 758.2±32.67ns 751.1±33.43ns +0.95%
Mini js (Execution) 541.1±20.24µs 582.2±25.22µs -7.06%
Mini js (Full) 823.2±37.49µs 844.5±26.53µs -2.52%
Mini js (Parser) 34.9±1.68µs 35.4±2.11µs -1.41%
Number Object Access (Execution) 3.7±0.14µs 3.8±0.12µs -2.63%
Number Object Access (Full) 227.9±8.81µs 233.9±7.44µs -2.57%
Object Creation (Execution) 4.1±0.15µs 4.0±0.16µs +2.50%
Object Creation (Full) 231.6±8.28µs 239.6±6.53µs -3.34%
RegExp (Execution) 10.4±0.35µs 10.3±0.40µs +0.97%
RegExp (Full) 234.4±9.55µs 236.3±7.74µs -0.80%
RegExp Literal (Execution) 10.7±0.35µs 9.9±0.36µs +8.08%
RegExp Literal (Full) 237.1±8.46µs 236.8±8.49µs +0.13%
RegExp Literal Creation (Execution) 9.2±0.30µs 9.0±0.24µs +2.22%
RegExp Literal Creation (Full) 226.5±8.95µs 236.0±9.61µs -4.03%
Static Object Property Access (Execution) 4.2±0.15µs 4.2±0.15µs 0.00%
Static Object Property Access (Full) 234.7±7.68µs 227.7±10.72µs +3.07%
String Object Access (Execution) 6.6±0.26µs 7.0±0.16µs -5.71%
String Object Access (Full) 234.8±8.79µs 240.4±11.91µs -2.33%
String comparison (Execution) 6.2±0.16µs 6.2±0.21µs 0.00%
String comparison (Full) 229.6±11.33µs 240.4±10.05µs -4.49%
String concatenation (Execution) 4.9±0.18µs 5.0±0.22µs -2.00%
String concatenation (Full) 232.6±8.33µs 241.8±4.12µs -3.80%
String copy (Execution) 3.7±0.17µs 3.7±0.10µs 0.00%
String copy (Full) 222.6±6.99µs 221.9±14.49µs +0.32%
Symbols (Execution) 3.2±0.12µs 3.1±0.10µs +3.23%
Symbols (Full) 224.6±11.06µs 219.9±6.81µs +2.14%

@github-actions
Copy link

Benchmark for 24ea698

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 368.6±13.71ns 361.1±10.30ns +2.08%
Arithmetic operations (Full) 255.7±12.58µs 247.8±7.97µs +3.19%
Array access (Execution) 6.8±0.26µs 6.8±0.26µs 0.00%
Array access (Full) 280.6±15.98µs 279.9±16.71µs +0.25%
Array creation (Execution) 2.9±0.09ms 2.9±0.09ms 0.00%
Array creation (Full) 3.2±0.10ms 3.1±0.14ms +3.23%
Array pop (Execution) 949.0±37.67µs 926.8±29.17µs +2.40%
Array pop (Full) 1406.4±55.03µs 1389.8±52.76µs +1.19%
Boolean Object Access (Execution) 5.3±0.22µs 5.5±0.37µs -3.64%
Boolean Object Access (Full) 285.0±13.54µs 273.2±10.35µs +4.32%
Clean js (Execution) 714.4±45.90µs 712.8±31.00µs +0.22%
Clean js (Full) 1028.1±50.64µs 1047.1±74.75µs -1.81%
Clean js (Parser) 46.7±1.47µs 46.0±1.82µs +1.52%
Create Realm 479.0±25.43ns 480.1±33.83ns -0.23%
Dynamic Object Property Access (Execution) 5.4±0.16µs 5.7±0.22µs -5.26%
Dynamic Object Property Access (Full) 274.5±8.54µs 275.8±14.99µs -0.47%
Expression (Parser) 7.0±0.15µs 7.3±0.40µs -4.11%
Fibonacci (Execution) 970.5±39.02µs 973.9±27.63µs -0.35%
Fibonacci (Full) 1246.9±31.85µs 1255.2±50.33µs -0.66%
For loop (Execution) 24.7±3.84µs 25.2±1.36µs -1.98%
For loop (Full) 301.2±14.29µs 301.7±15.94µs -0.17%
For loop (Parser) 22.1±1.30µs 21.5±0.82µs +2.79%
Goal Symbols (Parser) 15.4±0.80µs 15.0±0.75µs +2.67%
Hello World (Parser) 4.1±0.48µs 4.1±0.23µs 0.00%
Long file (Parser) 799.3±27.18ns 795.8±31.49ns +0.44%
Mini js (Execution) 626.0±37.92µs 625.2±26.31µs +0.13%
Mini js (Full) 921.5±25.08µs 977.1±83.49µs -5.69%
Mini js (Parser) 41.2±1.49µs 40.3±1.20µs +2.23%
Number Object Access (Execution) 4.2±0.26µs 4.3±0.14µs -2.33%
Number Object Access (Full) 271.3±8.19µs 282.0±27.52µs -3.79%
Object Creation (Execution) 4.7±0.17µs 4.8±0.22µs -2.08%
Object Creation (Full) 268.2±14.06µs 267.6±13.51µs +0.22%
RegExp (Execution) 11.7±0.50µs 11.6±0.56µs +0.86%
RegExp (Full) 282.0±11.19µs 286.3±22.17µs -1.50%
RegExp Literal (Execution) 12.0±1.94µs 11.9±1.41µs +0.84%
RegExp Literal (Full) 282.4±9.79µs 281.4±12.88µs +0.36%
RegExp Literal Creation (Execution) 10.0±0.45µs 10.1±0.43µs -0.99%
RegExp Literal Creation (Full) 273.2±10.22µs 272.0±12.68µs +0.44%
Static Object Property Access (Execution) 4.9±0.18µs 5.1±0.22µs -3.92%
Static Object Property Access (Full) 274.2±11.38µs 274.1±9.49µs +0.04%
String Object Access (Execution) 7.4±0.27µs 7.8±0.44µs -5.13%
String Object Access (Full) 285.2±13.18µs 274.4±8.44µs +3.94%
String comparison (Execution) 6.8±0.34µs 6.8±0.25µs 0.00%
String comparison (Full) 272.9±12.62µs 279.0±21.90µs -2.19%
String concatenation (Execution) 5.6±0.28µs 5.7±0.22µs -1.75%
String concatenation (Full) 282.5±57.34µs 278.0±11.64µs +1.62%
String copy (Execution) 4.3±0.23µs 4.3±0.11µs 0.00%
String copy (Full) 261.7±16.06µs 260.3±11.29µs +0.54%
Symbols (Execution) 3.9±0.19µs 4.0±0.13µs -2.50%
Symbols (Full) 261.0±14.55µs 257.4±11.46µs +1.40%

@github-actions
Copy link

Benchmark for e3a0c10

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 363.6±3.82ns 376.5±0.29ns -3.43%
Arithmetic operations (Full) 234.3±7.35µs 235.1±0.34µs -0.34%
Array access (Execution) 6.3±0.09µs 6.3±0.02µs 0.00%
Array access (Full) 257.0±0.46µs 253.8±0.36µs +1.26%
Array creation (Execution) 2.9±0.01ms 3.0±0.03ms -3.33%
Array creation (Full) 3.3±0.01ms 3.3±0.00ms 0.00%
Array pop (Execution) 918.6±3.11µs 967.4±4.21µs -5.04%
Array pop (Full) 1438.5±3.00µs 1416.9±3.19µs +1.52%
Boolean Object Access (Execution) 5.2±0.02µs 5.2±0.03µs 0.00%
Boolean Object Access (Full) 253.3±0.52µs 253.6±0.62µs -0.12%
Clean js (Execution) 675.9±3.63µs 687.5±3.14µs -1.69%
Clean js (Full) 977.0±6.11µs 984.5±8.20µs -0.76%
Clean js (Parser) 43.9±0.11µs 43.6±0.05µs +0.69%
Create Realm 470.7±0.74ns 468.1±0.43ns +0.56%
Dynamic Object Property Access (Execution) 5.0±0.01µs 5.1±0.02µs -1.96%
Dynamic Object Property Access (Full) 253.9±0.61µs 250.1±0.53µs +1.52%
Expression (Parser) 7.1±0.02µs 7.1±0.01µs 0.00%
Fibonacci (Execution) 839.7±2.01µs 858.9±1.74µs -2.24%
Fibonacci (Full) 1119.6±2.83µs 1131.9±1.70µs -1.09%
For loop (Execution) 23.2±0.36µs 23.3±0.07µs -0.43%
For loop (Full) 277.6±0.50µs 275.7±0.40µs +0.69%
For loop (Parser) 21.0±0.04µs 20.8±0.03µs +0.96%
Goal Symbols (Parser) 14.8±0.03µs 14.6±0.03µs +1.37%
Hello World (Parser) 3.9±0.13µs 3.9±0.01µs 0.00%
Long file (Parser) 800.5±1.02ns 798.1±0.88ns +0.30%
Mini js (Execution) 606.8±5.26µs 616.0±3.39µs -1.49%
Mini js (Full) 885.0±3.83µs 892.7±4.58µs -0.86%
Mini js (Parser) 38.8±0.06µs 38.4±0.09µs +1.04%
Number Object Access (Execution) 4.1±0.01µs 4.1±0.01µs 0.00%
Number Object Access (Full) 249.2±0.49µs 248.6±0.83µs +0.24%
Object Creation (Execution) 4.3±0.01µs 4.4±0.01µs -2.27%
Object Creation (Full) 247.0±0.75µs 245.2±0.80µs +0.73%
RegExp (Execution) 11.2±0.04µs 11.1±0.04µs +0.90%
RegExp (Full) 256.1±0.40µs 256.7±1.00µs -0.23%
RegExp Literal (Execution) 11.2±0.07µs 11.0±0.04µs +1.82%
RegExp Literal (Full) 261.9±0.40µs 257.9±0.37µs +1.55%
RegExp Literal Creation (Execution) 9.7±0.03µs 9.6±0.03µs +1.04%
RegExp Literal Creation (Full) 253.1±0.76µs 253.8±0.84µs -0.28%
Static Object Property Access (Execution) 4.6±0.03µs 4.6±0.02µs 0.00%
Static Object Property Access (Full) 249.6±0.41µs 248.6±0.82µs +0.40%
String Object Access (Execution) 7.2±0.03µs 7.2±0.02µs 0.00%
String Object Access (Full) 255.9±0.88µs 254.6±0.40µs +0.51%
String comparison (Execution) 6.5±0.02µs 6.6±0.03µs -1.52%
String comparison (Full) 254.4±1.05µs 254.2±0.67µs +0.08%
String concatenation (Execution) 5.4±0.02µs 5.3±0.01µs +1.89%
String concatenation (Full) 249.2±0.36µs 246.9±0.61µs +0.93%
String copy (Execution) 4.1±0.01µs 4.0±0.04µs +2.50%
String copy (Full) 243.5±0.61µs 240.7±0.37µs +1.16%
Symbols (Execution) 3.4±0.01µs 3.4±0.01µs 0.00%
Symbols (Full) 236.4±0.78µs 235.6±0.31µs +0.34%

@github-actions
Copy link

Benchmark for cce28a5

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 406.0±25.83ns 377.7±16.35ns +7.49%
Arithmetic operations (Full) 266.3±11.94µs 269.8±15.88µs -1.30%
Array access (Execution) 7.3±0.46µs 7.2±0.48µs +1.39%
Array access (Full) 294.3±13.97µs 296.9±17.79µs -0.88%
Array creation (Execution) 2.9±0.19ms 2.9±0.14ms 0.00%
Array creation (Full) 3.2±0.13ms 3.2±0.17ms 0.00%
Array pop (Execution) 916.1±49.76µs 968.0±57.42µs -5.36%
Array pop (Full) 1508.8±95.43µs 1470.7±99.75µs +2.59%
Boolean Object Access (Execution) 5.6±0.42µs 5.6±0.30µs 0.00%
Boolean Object Access (Full) 299.1±28.42µs 281.7±13.90µs +6.18%
Clean js (Execution) 732.6±32.15µs 703.5±32.07µs +4.14%
Clean js (Full) 1069.1±40.12µs 1048.9±93.66µs +1.93%
Clean js (Parser) 46.3±2.10µs 49.1±2.30µs -5.70%
Create Realm 474.9±30.86ns 463.0±55.41ns +2.57%
Dynamic Object Property Access (Execution) 5.9±0.43µs 5.9±0.50µs 0.00%
Dynamic Object Property Access (Full) 298.1±11.51µs 303.2±18.86µs -1.68%
Expression (Parser) 7.2±0.48µs 7.7±0.31µs -6.49%
Fibonacci (Execution) 1000.8±43.02µs 1004.3±45.51µs -0.35%
Fibonacci (Full) 1288.7±77.01µs 1290.5±75.70µs -0.14%
For loop (Execution) 26.0±1.73µs 26.3±1.26µs -1.14%
For loop (Full) 323.6±18.45µs 314.8±18.12µs +2.80%
For loop (Parser) 22.8±1.08µs 22.6±1.23µs +0.88%
Goal Symbols (Parser) 15.4±0.74µs 15.0±0.73µs +2.67%
Hello World (Parser) 4.1±0.33µs 4.3±0.43µs -4.65%
Long file (Parser) 843.8±36.89ns 808.1±43.48ns +4.42%
Mini js (Execution) 623.9±34.89µs 644.2±30.58µs -3.15%
Mini js (Full) 975.8±79.60µs 936.6±50.93µs +4.19%
Mini js (Parser) 41.4±1.97µs 42.8±2.33µs -3.27%
Number Object Access (Execution) 4.4±0.22µs 4.4±0.27µs 0.00%
Number Object Access (Full) 286.3±15.23µs 279.0±14.58µs +2.62%
Object Creation (Execution) 5.0±0.30µs 5.2±0.28µs -3.85%
Object Creation (Full) 284.0±13.68µs 282.5±14.62µs +0.53%
RegExp (Execution) 11.8±0.60µs 11.8±0.66µs 0.00%
RegExp (Full) 290.0±14.13µs 291.4±16.36µs -0.48%
RegExp Literal (Execution) 12.1±0.81µs 12.2±1.32µs -0.82%
RegExp Literal (Full) 300.9±20.58µs 308.9±74.74µs -2.59%
RegExp Literal Creation (Execution) 10.3±0.98µs 10.8±0.65µs -4.63%
RegExp Literal Creation (Full) 302.0±25.69µs 281.5±19.72µs +7.28%
Static Object Property Access (Execution) 5.3±0.28µs 5.5±0.28µs -3.64%
Static Object Property Access (Full) 284.3±17.04µs 288.0±16.34µs -1.28%
String Object Access (Execution) 7.6±0.42µs 8.1±0.46µs -6.17%
String Object Access (Full) 282.6±12.87µs 285.9±13.54µs -1.15%
String comparison (Execution) 7.1±0.43µs 7.3±0.44µs -2.74%
String comparison (Full) 287.1±21.52µs 290.7±14.68µs -1.24%
String concatenation (Execution) 5.9±0.37µs 6.1±0.29µs -3.28%
String concatenation (Full) 286.8±30.76µs 275.8±13.12µs +3.99%
String copy (Execution) 4.7±0.67µs 4.4±0.25µs +6.82%
String copy (Full) 273.5±16.98µs 280.2±12.88µs -2.39%
Symbols (Execution) 4.0±0.28µs 3.9±0.23µs +2.56%
Symbols (Full) 265.2±13.09µs 273.6±15.85µs -3.07%

@HalidOdat HalidOdat force-pushed the fix/environments branch from fa6e4d1 to f52c86f Compare May 3, 2021 21:02
@HalidOdat HalidOdat marked this pull request as ready for review May 3, 2021 21:04
@github-actions
Copy link

github-actions bot commented May 3, 2021

Benchmark for 9b446ce

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 294.8±1.19ns 308.8±0.46ns -4.53%
Arithmetic operations (Full) 206.9±1.33µs 212.6±0.27µs -2.68%
Array access (Execution) 5.2±0.01µs 5.1±0.01µs +1.96%
Array access (Full) 225.7±0.61µs 229.7±0.44µs -1.74%
Array creation (Execution) 2.4±0.01ms 2.5±0.00ms -4.00%
Array creation (Full) 2.7±0.02ms 2.6±0.00ms +3.85%
Array pop (Execution) 771.9±2.32µs 793.4±1.93µs -2.71%
Array pop (Full) 1200.9±25.68µs 1183.4±1.83µs +1.48%
Boolean Object Access (Execution) 4.4±0.01µs 4.5±0.01µs -2.22%
Boolean Object Access (Full) 227.2±0.44µs 227.4±0.32µs -0.09%
Clean js (Execution) 549.3±2.83µs 566.5±2.37µs -3.04%
Clean js (Full) 808.9±4.37µs 815.8±5.47µs -0.85%
Clean js (Parser) 38.0±0.03µs 37.8±0.04µs +0.53%
Create Realm 365.8±12.02ns 383.8±1.02ns -4.69%
Dynamic Object Property Access (Execution) 4.2±0.01µs 4.2±0.01µs 0.00%
Dynamic Object Property Access (Full) 223.8±0.25µs 230.3±0.38µs -2.82%
Expression (Parser) 5.9±0.02µs 5.9±0.02µs 0.00%
Fibonacci (Execution) 647.8±1.30µs 658.6±1.39µs -1.64%
Fibonacci (Full) 869.6±0.90µs 888.3±1.47µs -2.11%
For loop (Execution) 18.0±0.05µs 18.6±0.05µs -3.23%
For loop (Full) 241.4±0.33µs 242.3±3.46µs -0.37%
For loop (Parser) 17.9±0.03µs 18.0±0.05µs -0.56%
Goal Symbols (Parser) 12.6±0.03µs 12.6±0.04µs 0.00%
Hello World (Parser) 3.4±0.01µs 3.4±0.00µs 0.00%
Long file (Parser) 720.6±12.52ns 710.2±3.29ns +1.46%
Mini js (Execution) 501.9±2.72µs 501.6±2.52µs +0.06%
Mini js (Full) 750.7±2.31µs 749.1±2.38µs +0.21%
Mini js (Parser) 33.4±0.21µs 33.5±0.04µs -0.30%
Number Object Access (Execution) 3.5±0.03µs 3.6±0.01µs -2.78%
Number Object Access (Full) 220.6±0.28µs 222.6±0.27µs -0.90%
Object Creation (Execution) 3.7±0.01µs 3.6±0.01µs +2.78%
Object Creation (Full) 222.3±0.40µs 226.6±1.16µs -1.90%
RegExp (Execution) 8.0±0.01µs 8.2±0.02µs -2.44%
RegExp (Full) 226.0±0.43µs 233.5±0.35µs -3.21%
RegExp Literal (Execution) 9.3±0.03µs 9.4±0.02µs -1.06%
RegExp Literal (Full) 230.8±0.32µs 237.1±2.71µs -2.66%
RegExp Literal Creation (Execution) 8.1±0.03µs 8.2±0.02µs -1.22%
RegExp Literal Creation (Full) 222.6±0.44µs 227.5±0.40µs -2.15%
Static Object Property Access (Execution) 3.9±0.03µs 3.8±0.01µs +2.63%
Static Object Property Access (Full) 221.0±0.23µs 225.7±0.48µs -2.08%
String Object Access (Execution) 6.3±0.03µs 6.3±0.02µs 0.00%
String Object Access (Full) 225.4±0.30µs 229.5±0.32µs -1.79%
String comparison (Execution) 5.5±0.02µs 5.4±0.02µs +1.85%
String comparison (Full) 224.8±0.45µs 228.6±0.51µs -1.66%
String concatenation (Execution) 4.4±0.03µs 4.4±0.01µs 0.00%
String concatenation (Full) 220.4±0.33µs 225.5±0.31µs -2.26%
String copy (Execution) 3.3±0.04µs 3.3±0.01µs 0.00%
String copy (Full) 215.0±0.28µs 217.2±0.38µs -1.01%
Symbols (Execution) 2.8±0.00µs 2.8±0.01µs 0.00%
Symbols (Full) 206.3±1.74µs 208.5±0.32µs -1.06%

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.

Just confused about the switch to todo!(), the rest looks good.

@github-actions
Copy link

github-actions bot commented May 7, 2021

Benchmark for cf586e1

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 328.5±16.32ns 339.4±12.27ns -3.21%
Arithmetic operations (Full) 244.3±11.67µs 255.3±15.43µs -4.31%
Array access (Execution) 6.3±0.28µs 6.2±0.23µs +1.61%
Array access (Full) 270.1±15.09µs 324.0±87.04µs -16.64%
Array creation (Execution) 2.6±0.13ms 2.7±0.14ms -3.70%
Array creation (Full) 2.9±0.14ms 3.6±0.89ms -19.44%
Array pop (Execution) 825.4±37.22µs 843.0±35.81µs -2.09%
Array pop (Full) 1332.9±79.63µs 1464.5±50.43µs -8.99%
Boolean Object Access (Execution) 5.3±0.38µs 5.2±0.34µs +1.92%
Boolean Object Access (Full) 267.1±14.61µs 270.6±12.66µs -1.29%
Clean js (Execution) 631.0±26.13µs 637.0±31.17µs -0.94%
Clean js (Full) 951.7±75.47µs 955.7±51.48µs -0.42%
Clean js (Parser) 40.9±4.31µs 44.6±2.15µs -8.30%
Create Realm 387.2±13.53ns 411.5±16.42ns -5.91%
Dynamic Object Property Access (Execution) 5.2±0.27µs 5.2±0.33µs 0.00%
Dynamic Object Property Access (Full) 262.3±9.98µs 309.6±22.15µs -15.28%
Expression (Parser) 6.2±0.28µs 6.9±0.29µs -10.14%
Fibonacci (Execution) 830.0±54.25µs 824.4±36.23µs +0.68%
Fibonacci (Full) 1043.9±45.87µs 1180.0±93.53µs -11.53%
For loop (Execution) 22.1±1.35µs 22.2±1.18µs -0.45%
For loop (Full) 288.9±17.33µs 289.0±11.74µs -0.03%
For loop (Parser) 18.9±1.09µs 21.2±1.02µs -10.85%
Goal Symbols (Parser) 13.2±0.82µs 14.5±0.48µs -8.97%
Hello World (Parser) 3.5±0.14µs 3.8±0.23µs -7.89%
Long file (Parser) 751.4±33.34ns 853.1±109.30ns -11.92%
Mini js (Execution) 581.3±47.55µs 573.1±27.75µs +1.43%
Mini js (Full) 847.0±36.82µs 920.2±74.04µs -7.95%
Mini js (Parser) 34.4±1.67µs 39.2±1.83µs -12.24%
Number Object Access (Execution) 4.0±0.17µs 4.2±0.27µs -4.76%
Number Object Access (Full) 265.0±17.09µs 267.0±16.68µs -0.75%
Object Creation (Execution) 4.3±0.26µs 4.5±0.25µs -4.44%
Object Creation (Full) 259.1±11.85µs 303.7±23.95µs -14.69%
RegExp (Execution) 11.1±1.04µs 11.1±0.62µs 0.00%
RegExp (Full) 270.3±11.44µs 298.8±9.50µs -9.54%
RegExp Literal (Execution) 10.8±0.51µs 11.0±0.56µs -1.82%
RegExp Literal (Full) 277.9±12.93µs 307.8±14.97µs -9.71%
RegExp Literal Creation (Execution) 9.4±0.42µs 9.6±0.49µs -2.08%
RegExp Literal Creation (Full) 265.7±13.10µs 282.7±16.28µs -6.01%
Static Object Property Access (Execution) 4.6±0.25µs 4.7±0.21µs -2.13%
Static Object Property Access (Full) 263.9±13.15µs 300.3±16.54µs -12.12%
String Object Access (Execution) 7.1±0.43µs 7.3±0.46µs -2.74%
String Object Access (Full) 271.9±14.31µs 284.7±17.57µs -4.50%
String comparison (Execution) 6.5±0.33µs 6.8±0.41µs -4.41%
String comparison (Full) 268.2±20.98µs 296.9±12.95µs -9.67%
String concatenation (Execution) 5.4±0.34µs 5.6±0.54µs -3.57%
String concatenation (Full) 256.9±11.24µs 289.9±14.84µs -11.38%
String copy (Execution) 3.9±0.23µs 4.1±0.18µs -4.88%
String copy (Full) 252.8±17.10µs 284.0±20.44µs -10.99%
Symbols (Execution) 3.3±0.17µs 3.4±0.19µs -2.94%
Symbols (Full) 244.5±13.33µs 244.5±16.28µs 0.00%

@HalidOdat HalidOdat requested a review from RageKnify May 8, 2021 19:57
@HalidOdat HalidOdat added this to the v0.12.0 milestone May 8, 2021
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'm OK with these changes, but since it's adding 14 new panics and makes 6 extra tests fail, I would need a bit more of rationale to understand why this change is needed / useful for us.

@HalidOdat
Copy link
Member Author

I'm OK with these changes, but since it's adding 14 new panics and makes 6 extra tests fail, I would need a bit more of rationale to understand why this change is needed / useful for us.

Sorry, I should have explained this before 😅

The environment methods needs to take &mut Context because:

  • They call methods which take a context
  • Throws directly

We went around this problem by using ErrorKind which could be a reference or type error this solved the second problem of environments throwing directly (albeit in a bit of a messy way since we needed to call .map(|e| ...) to converted it into an actual error object).
But the first issue was still not solved and we were not able to use methods which take context (mostly internal object methods like [[get]], [[set]], [[hasProperty]] etc). And because of this we still have a dependency on the methods which are not spec compliant, and should be removed like Value::has_property() , Value::get_property() (this is related to #577)

@HalidOdat HalidOdat requested a review from Razican May 10, 2021 14:46
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.

The code looks more idiomatic, for sure. Hopefully we can solve the extra panics and new failing tests in a new PR. I'm happy with it as-is.

@github-actions
Copy link

Benchmark for 247066f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 264.1±0.16ns 312.3±0.18ns -15.43%
Arithmetic operations (Full) 191.8±0.19µs 191.7±0.25µs +0.05%
Array access (Execution) 5.1±0.03µs 4.6±0.01µs +10.87%
Array access (Full) 237.4±0.25µs 209.0±0.31µs +13.59%
Array creation (Execution) 2.4±0.00ms 2.2±0.00ms +9.09%
Array creation (Full) 2.6±0.00ms 2.4±0.04ms +8.33%
Array pop (Execution) 776.8±2.52µs 702.4±1.71µs +10.59%
Array pop (Full) 1183.0±1.89µs 1039.9±2.49µs +13.76%
Boolean Object Access (Execution) 3.9±0.01µs 3.9±0.01µs 0.00%
Boolean Object Access (Full) 210.7±10.97µs 206.4±4.25µs +2.08%
Clean js (Execution) 487.2±3.81µs 557.1±3.56µs -12.55%
Clean js (Full) 716.1±3.54µs 718.6±2.81µs -0.35%
Clean js (Parser) 31.3±0.03µs 31.2±0.05µs +0.32%
Create Realm 377.8±0.34ns 364.2±2.93ns +3.73%
Dynamic Object Property Access (Execution) 3.7±0.01µs 3.8±0.02µs -2.63%
Dynamic Object Property Access (Full) 235.8±0.47µs 206.8±0.24µs +14.02%
Expression (Parser) 5.7±0.00µs 5.7±0.01µs 0.00%
Fibonacci (Execution) 640.2±3.08µs 582.5±1.61µs +9.91%
Fibonacci (Full) 880.7±1.11µs 800.6±11.87µs +10.00%
For loop (Execution) 16.2±0.10µs 18.5±0.09µs -12.43%
For loop (Full) 249.7±0.40µs 220.4±0.31µs +13.29%
For loop (Parser) 15.0±0.05µs 17.0±0.04µs -11.76%
Goal Symbols (Parser) 11.8±0.02µs 10.5±0.02µs +12.38%
Hello World (Parser) 2.8±0.00µs 3.2±0.01µs -12.50%
Long file (Parser) 646.6±5.96ns 634.8±2.88ns +1.86%
Mini js (Execution) 436.8±2.42µs 442.4±2.92µs -1.27%
Mini js (Full) 670.7±4.87µs 668.8±2.17µs +0.28%
Mini js (Parser) 27.7±0.26µs 27.4±0.02µs +1.09%
Number Object Access (Execution) 3.1±0.00µs 3.1±0.00µs 0.00%
Number Object Access (Full) 201.9±0.34µs 202.5±0.34µs -0.30%
Object Creation (Execution) 3.6±0.01µs 3.1±0.00µs +16.13%
Object Creation (Full) 231.5±0.54µs 203.5±0.42µs +13.76%
RegExp (Execution) 8.8±0.03µs 8.7±0.02µs +1.15%
RegExp (Full) 237.5±0.53µs 237.7±0.36µs -0.08%
RegExp Literal (Execution) 8.8±0.04µs 8.7±0.03µs +1.15%
RegExp Literal (Full) 242.3±0.41µs 241.6±0.34µs +0.29%
RegExp Literal Creation (Execution) 8.8±0.04µs 7.7±0.03µs +14.29%
RegExp Literal Creation (Full) 235.1±0.31µs 234.9±0.40µs +0.09%
Static Object Property Access (Execution) 3.3±0.01µs 3.4±0.02µs -2.94%
Static Object Property Access (Full) 232.7±0.37µs 204.8±0.35µs +13.62%
String Object Access (Execution) 5.4±0.01µs 6.1±0.02µs -11.48%
String Object Access (Full) 208.6±3.78µs 208.8±0.48µs -0.10%
String comparison (Execution) 4.8±0.01µs 4.9±0.02µs -2.04%
String comparison (Full) 235.0±0.36µs 207.6±0.47µs +13.20%
String concatenation (Execution) 3.8±0.01µs 4.0±0.01µs -5.00%
String concatenation (Full) 229.2±0.33µs 201.9±0.31µs +13.52%
String copy (Execution) 2.9±0.01µs 2.9±0.01µs 0.00%
String copy (Full) 223.8±0.38µs 198.5±2.46µs +12.75%
Symbols (Execution) 2.8±0.01µs 2.8±0.01µs 0.00%
Symbols (Full) 215.1±1.14µs 189.9±0.49µs +13.27%

@HalidOdat HalidOdat merged commit 411d57a into master May 10, 2021
@HalidOdat HalidOdat deleted the fix/environments branch May 10, 2021 21:44
Razican pushed a commit that referenced this pull request May 22, 2021
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 technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants