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

NaN-boxed JsValues #1830

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

NaN-boxed JsValues #1830

wants to merge 2 commits into from

Conversation

HalidOdat
Copy link
Member

This Pull Request fixes/closes #1373

This PR implements JsValue NaN boxing It is a work in progress, and requires a lot more changes.

@HalidOdat HalidOdat added performance Performance related changes and issues technical debt execution Issues or PRs related to code execution labels Feb 8, 2022
@github-actions
Copy link

github-actions bot commented Feb 8, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 91,733 91,733 0
Passed 64,890 64,890 0
Ignored 16,580 16,580 0
Failed 10,263 10,263 0
Panics 0 0 0
Conformance 70.74% 70.74% 0.00%

@codecov
Copy link

codecov bot commented Feb 8, 2022

Codecov Report

Merging #1830 (9217432) into main (92ecbda) will decrease coverage by 0.24%.
The diff coverage is 37.09%.

@@            Coverage Diff             @@
##             main    #1830      +/-   ##
==========================================
- Coverage   41.33%   41.09%   -0.25%     
==========================================
  Files         234      236       +2     
  Lines       22019    22121     +102     
==========================================
- Hits         9101     9090      -11     
- Misses      12918    13031     +113     
Impacted Files Coverage Δ
boa_cli/src/main.rs 5.55% <ø> (ø)
boa_engine/src/bigint.rs 39.09% <ø> (+0.75%) ⬆️
boa_engine/src/builtins/array_buffer/mod.rs 9.84% <0.00%> (+0.07%) ⬆️
boa_engine/src/builtins/async_generator/mod.rs 7.75% <0.00%> (ø)
boa_engine/src/builtins/bigint/mod.rs 80.39% <ø> (ø)
boa_engine/src/builtins/console/mod.rs 25.64% <0.00%> (+1.70%) ⬆️
boa_engine/src/builtins/dataview/mod.rs 8.16% <0.00%> (+0.08%) ⬆️
boa_engine/src/builtins/error/aggregate.rs 38.88% <0.00%> (ø)
boa_engine/src/builtins/eval/mod.rs 12.50% <0.00%> (ø)
boa_engine/src/builtins/function/arguments.rs 81.63% <ø> (-0.73%) ⬇️
... and 101 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

github-actions bot commented Feb 8, 2022

Benchmark for 1c5cdd5

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 384.8±3.45ns 387.6±1.65ns +0.73%
Arithmetic operations (Execution) 1810.8±5.54ns 1895.7±2.00ns +4.69%
Arithmetic operations (Parser) 5.8±0.06µs 5.8±0.05µs 0.00%
Array access (Compiler) 823.1±4.24ns 864.9±8.80ns +5.08%
Array access (Execution) 10.9±0.03µs 11.2±0.04µs +2.75%
Array access (Parser) 12.8±0.06µs 13.0±0.05µs +1.56%
Array creation (Compiler) 1209.8±30.87ns 1254.0±4.65ns +3.65%
Array creation (Execution) 3.1±0.02ms 3.6±0.07ms +16.13%
Array creation (Parser) 14.4±0.04µs 14.1±0.04µs -2.08%
Array pop (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Array pop (Execution) 1357.3±4.41µs 1515.4±5.04µs +11.65%
Array pop (Parser) 145.2±0.15µs 150.5±0.25µs +3.65%
Boolean Object Access (Compiler) 683.1±1.20ns 692.7±0.99ns +1.41%
Boolean Object Access (Execution) 6.9±0.01µs 7.4±0.07µs +7.25%
Boolean Object Access (Parser) 14.4±0.01µs 14.6±0.03µs +1.39%
Clean js (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Clean js (Execution) 1439.0±8.18µs 1532.7±8.15µs +6.51%
Clean js (Parser) 30.3±0.06µs 30.0±0.07µs -0.99%
Create Realm 323.4±0.47ns 347.2±1.05ns +7.36%
Dynamic Object Property Access (Compiler) 1201.5±5.68ns 1199.3±8.11ns -0.18%
Dynamic Object Property Access (Execution) 7.0±0.05µs 7.1±0.03µs +1.43%
Dynamic Object Property Access (Parser) 11.4±0.04µs 11.6±0.11µs +1.75%
Fibonacci (Compiler) 1529.1±5.23ns 1539.6±6.07ns +0.69%
Fibonacci (Execution) 2.8±0.00ms 2.9±0.01ms +3.57%
Fibonacci (Parser) 17.1±0.07µs 17.0±0.06µs -0.58%
For loop (Compiler) 1346.0±2.68ns 1368.1±3.30ns +1.64%
For loop (Execution) 41.7±0.45µs 42.6±0.82µs +2.16%
For loop (Parser) 14.8±0.08µs 14.7±0.03µs -0.68%
Mini js (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Mini js (Execution) 1349.8±14.22µs 1419.6±11.39µs +5.17%
Mini js (Parser) 26.8±0.10µs 26.2±0.10µs -2.24%
Number Object Access (Compiler) 637.1±10.58ns 654.4±1.35ns +2.72%
Number Object Access (Execution) 5.4±0.01µs 5.5±0.02µs +1.85%
Number Object Access (Parser) 11.4±0.04µs 11.6±0.04µs +1.75%
Object Creation (Compiler) 990.5±4.16ns 1018.2±4.00ns +2.80%
Object Creation (Execution) 6.3±0.03µs 6.4±0.03µs +1.59%
Object Creation (Parser) 10.0±0.05µs 10.1±0.08µs +1.00%
RegExp (Compiler) 1192.5±5.05ns 1223.9±5.66ns +2.63%
RegExp (Execution) 13.1±0.03µs 13.5±0.05µs +3.05%
RegExp (Parser) 10.9±0.11µs 10.8±0.07µs -0.92%
RegExp Creation (Compiler) 1080.1±7.90ns 1095.1±4.18ns +1.39%
RegExp Creation (Execution) 9.8±0.07µs 9.9±0.04µs +1.02%
RegExp Creation (Parser) 9.0±0.03µs 9.1±0.32µs +1.11%
RegExp Literal (Compiler) 1193.8±7.29ns 1229.2±7.09ns +2.97%
RegExp Literal (Execution) 13.1±0.03µs 13.4±0.04µs +2.29%
RegExp Literal (Parser) 8.8±0.06µs 9.0±0.11µs +2.27%
RegExp Literal Creation (Compiler) 1097.7±3.08ns 1095.2±3.87ns -0.23%
RegExp Literal Creation (Execution) 9.8±0.05µs 10.0±0.30µs +2.04%
RegExp Literal Creation (Parser) 6.9±0.02µs 6.9±0.03µs 0.00%
Static Object Property Access (Compiler) 1019.0±2.91ns 1027.3±14.77ns +0.81%
Static Object Property Access (Execution) 6.5±0.06µs 6.7±0.03µs +3.08%
Static Object Property Access (Parser) 10.7±0.04µs 10.7±0.05µs 0.00%
String Object Access (Compiler) 1047.6±3.64ns 1053.5±6.87ns +0.56%
String Object Access (Execution) 8.7±0.03µs 9.1±0.09µs +4.60%
String Object Access (Parser) 14.2±0.02µs 14.3±0.04µs +0.70%
String comparison (Compiler) 1350.2±11.55ns 1352.4±7.32ns +0.16%
String comparison (Execution) 7.4±0.07µs 7.7±0.05µs +4.05%
String comparison (Parser) 11.7±0.20µs 11.6±0.03µs -0.85%
String concatenation (Compiler) 1086.0±4.83ns 1093.4±3.05ns +0.68%
String concatenation (Execution) 6.4±0.05µs 6.5±0.03µs +1.56%
String concatenation (Parser) 8.0±0.02µs 8.1±0.04µs +1.25%
String copy (Compiler) 891.0±3.90ns 913.2±2.61ns +2.49%
String copy (Execution) 5.5±0.02µs 5.6±0.02µs +1.82%
String copy (Parser) 6.2±0.06µs 6.1±0.08µs -1.61%
Symbols (Compiler) 637.4±1.90ns 677.4±2.05ns +6.28%
Symbols (Execution) 5.0±0.06µs 5.3±0.10µs +6.00%
Symbols (Parser) 4.5±0.06µs 4.5±0.02µs 0.00%

@github-actions
Copy link

github-actions bot commented Feb 9, 2022

Benchmark for 48d894d

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 397.1±0.71ns 412.4±1.03ns +3.85%
Arithmetic operations (Execution) 1970.3±2.14ns 2.1±0.01µs +6.58%
Arithmetic operations (Parser) 5.6±0.01µs 5.6±0.04µs 0.00%
Array access (Compiler) 841.3±5.82ns 834.5±8.10ns -0.81%
Array access (Execution) 10.3±0.07µs 10.5±0.04µs +1.94%
Array access (Parser) 12.2±0.04µs 12.0±0.02µs -1.64%
Array creation (Compiler) 1163.3±3.76ns 1199.7±4.89ns +3.13%
Array creation (Execution) 3.2±0.01ms 3.9±0.01ms +21.87%
Array creation (Parser) 13.6±0.03µs 13.5±0.02µs -0.74%
Array pop (Compiler) 3.0±0.02µs 2.8±0.00µs -6.67%
Array pop (Execution) 1353.3±4.31µs 1567.9±5.61µs +15.86%
Array pop (Parser) 138.1±0.17µs 137.2±0.21µs -0.65%
Boolean Object Access (Compiler) 683.5±1.13ns 710.5±0.83ns +3.95%
Boolean Object Access (Execution) 6.8±0.02µs 7.0±0.02µs +2.94%
Boolean Object Access (Parser) 14.2±0.01µs 14.2±0.02µs 0.00%
Clean js (Compiler) 2.2±0.00µs 2.2±0.00µs 0.00%
Clean js (Execution) 1464.3±6.83µs 1541.2±21.56µs +5.25%
Clean js (Parser) 29.0±0.03µs 28.6±0.04µs -1.38%
Create Realm 328.6±3.40ns 340.5±0.21ns +3.62%
Dynamic Object Property Access (Compiler) 1146.1±2.39ns 1155.9±4.08ns +0.86%
Dynamic Object Property Access (Execution) 6.8±0.03µs 6.9±0.04µs +1.47%
Dynamic Object Property Access (Parser) 10.9±0.01µs 10.8±0.02µs -0.92%
Fibonacci (Compiler) 1480.8±6.27ns 1499.2±4.73ns +1.24%
Fibonacci (Execution) 2.7±0.00ms 2.8±0.00ms +3.70%
Fibonacci (Parser) 16.3±0.02µs 16.0±0.07µs -1.84%
For loop (Compiler) 1286.3±4.77ns 1302.8±8.09ns +1.28%
For loop (Execution) 43.2±0.15µs 44.9±0.18µs +3.94%
For loop (Parser) 14.1±0.03µs 13.8±0.03µs -2.13%
Mini js (Compiler) 2.1±0.00µs 2.2±0.01µs +4.76%
Mini js (Execution) 1360.6±23.86µs 1413.6±10.53µs +3.90%
Mini js (Parser) 25.3±0.02µs 25.1±0.04µs -0.79%
Number Object Access (Compiler) 657.0±5.69ns 666.6±1.44ns +1.46%
Number Object Access (Execution) 5.4±0.01µs 5.5±0.02µs +1.85%
Number Object Access (Parser) 11.2±0.02µs 11.2±0.04µs 0.00%
Object Creation (Compiler) 942.8±2.70ns 984.2±3.21ns +4.39%
Object Creation (Execution) 6.1±0.02µs 6.3±0.02µs +3.28%
Object Creation (Parser) 9.5±0.02µs 9.4±0.03µs -1.05%
RegExp (Compiler) 1149.0±5.52ns 1150.1±2.61ns +0.10%
RegExp (Execution) 13.1±0.04µs 12.9±0.11µs -1.53%
RegExp (Parser) 10.4±0.02µs 10.1±0.06µs -2.88%
RegExp Creation (Compiler) 1038.8±3.29ns 1047.2±4.31ns +0.81%
RegExp Creation (Execution) 9.9±0.05µs 9.9±0.05µs 0.00%
RegExp Creation (Parser) 8.7±0.02µs 8.5±0.01µs -2.30%
RegExp Literal (Compiler) 1143.1±4.99ns 1159.3±4.43ns +1.42%
RegExp Literal (Execution) 13.1±0.05µs 13.0±0.03µs -0.76%
RegExp Literal (Parser) 8.4±0.08µs 8.1±0.02µs -3.57%
RegExp Literal Creation (Compiler) 1015.7±4.83ns 1032.2±6.29ns +1.62%
RegExp Literal Creation (Execution) 9.9±0.05µs 10.0±0.06µs +1.01%
RegExp Literal Creation (Parser) 6.6±0.01µs 6.4±0.02µs -3.03%
Static Object Property Access (Compiler) 957.0±2.17ns 989.8±4.77ns +3.43%
Static Object Property Access (Execution) 6.4±0.03µs 6.5±0.03µs +1.56%
Static Object Property Access (Parser) 10.2±0.09µs 10.0±0.03µs -1.96%
String Object Access (Compiler) 1043.9±8.38ns 1051.6±6.96ns +0.74%
String Object Access (Execution) 8.6±0.04µs 8.7±0.01µs +1.16%
String Object Access (Parser) 14.0±0.01µs 13.9±0.04µs -0.71%
String comparison (Compiler) 1268.4±6.05ns 1308.7±9.18ns +3.18%
String comparison (Execution) 7.1±0.03µs 7.4±0.03µs +4.23%
String comparison (Parser) 11.1±0.10µs 11.0±0.02µs -0.90%
String concatenation (Compiler) 1044.4±4.29ns 1050.1±4.50ns +0.55%
String concatenation (Execution) 6.1±0.02µs 6.1±0.04µs 0.00%
String concatenation (Parser) 7.7±0.03µs 7.5±0.01µs -2.60%
String copy (Compiler) 853.3±3.59ns 903.7±3.01ns +5.91%
String copy (Execution) 5.2±0.02µs 5.3±0.01µs +1.92%
String copy (Parser) 5.7±0.01µs 5.6±0.03µs -1.75%
Symbols (Compiler) 650.5±1.31ns 671.7±1.92ns +3.26%
Symbols (Execution) 4.9±0.03µs 5.1±0.02µs +4.08%
Symbols (Parser) 4.4±0.01µs 4.3±0.01µs -2.27%

@jedel1043
Copy link
Member

Does rust-lang/rust#73328 affect the WebAssembly build?

@HalidOdat
Copy link
Member Author

Does rust-lang/rust#73328 affect the WebAssembly build?

I don't think it would, but I'll need to test this :)

@HalidOdat
Copy link
Member Author

Does rust-lang/rust#73328 affect the WebAssembly build?

I don't think it would, but I'll need to test this :)

It works just fine 🚀

@github-actions
Copy link

Benchmark for 9e3317e

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 479.4±1.63ns 461.0±1.55ns -3.84%
Arithmetic operations (Execution) 1946.3±7.67ns 2.2±0.00µs +13.03%
Arithmetic operations (Parser) 5.5±0.01µs 5.5±0.02µs 0.00%
Array access (Compiler) 1205.3±9.97ns 1220.4±3.90ns +1.25%
Array access (Execution) 10.3±0.03µs 10.7±0.04µs +3.88%
Array access (Parser) 11.9±0.02µs 11.9±0.04µs 0.00%
Array creation (Compiler) 1735.1±6.65ns 1809.2±6.26ns +4.27%
Array creation (Execution) 3.2±0.00ms 3.9±0.01ms +21.87%
Array creation (Parser) 13.4±0.02µs 13.3±0.02µs -0.75%
Array pop (Compiler) 3.3±0.02µs 3.6±0.01µs +9.09%
Array pop (Execution) 1349.9±3.40µs 1612.7±10.04µs +19.47%
Array pop (Parser) 136.7±0.15µs 137.5±0.14µs +0.59%
Boolean Object Access (Compiler) 1047.4±2.24ns 1071.8±2.61ns +2.33%
Boolean Object Access (Execution) 5.5±0.02µs 5.8±0.00µs +5.45%
Boolean Object Access (Parser) 14.0±0.02µs 14.3±0.02µs +2.14%
Clean js (Compiler) 3.3±0.01µs 3.2±0.02µs -3.03%
Clean js (Execution) 1074.5±6.05µs 1166.0±147.18µs +8.52%
Clean js (Parser) 28.6±0.04µs 28.6±0.05µs 0.00%
Create Realm 271.1±3.15ns 272.7±0.29ns +0.59%
Dynamic Object Property Access (Compiler) 1509.2±8.13ns 1545.0±10.61ns +2.37%
Dynamic Object Property Access (Execution) 6.9±0.04µs 7.1±0.02µs +2.90%
Dynamic Object Property Access (Parser) 10.6±0.02µs 10.7±0.01µs +0.94%
Fibonacci (Compiler) 2.2±0.02µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 2.7±0.01ms 2.8±0.00ms +3.70%
Fibonacci (Parser) 15.9±0.02µs 15.9±0.01µs 0.00%
For loop (Compiler) 1837.7±9.58ns 1935.4±13.21ns +5.32%
For loop (Execution) 41.2±0.16µs 44.1±0.15µs +7.04%
For loop (Parser) 13.9±0.02µs 13.8±0.02µs -0.72%
Mini js (Compiler) 3.2±0.01µs 3.2±0.02µs 0.00%
Mini js (Execution) 998.0±6.63µs 1065.4±6.48µs +6.75%
Mini js (Parser) 25.0±0.06µs 25.0±0.10µs 0.00%
Number Object Access (Compiler) 984.8±1.03ns 996.2±1.22ns +1.16%
Number Object Access (Execution) 4.3±0.01µs 4.6±0.01µs +6.98%
Number Object Access (Parser) 11.0±0.01µs 11.2±0.02µs +1.82%
Object Creation (Compiler) 1328.6±3.90ns 1383.1±11.04ns +4.10%
Object Creation (Execution) 6.3±0.03µs 6.4±0.04µs +1.59%
Object Creation (Parser) 9.1±0.02µs 9.2±0.02µs +1.10%
RegExp (Compiler) 1515.6±7.56ns 1552.7±3.34ns +2.45%
RegExp (Execution) 12.8±0.04µs 12.5±0.02µs -2.34%
RegExp (Parser) 10.0±0.01µs 10.0±0.02µs 0.00%
RegExp Creation (Compiler) 1300.4±2.07ns 1338.0±3.27ns +2.89%
RegExp Creation (Execution) 9.7±0.05µs 9.4±0.05µs -3.09%
RegExp Creation (Parser) 8.4±0.02µs 8.3±0.01µs -1.19%
RegExp Literal (Compiler) 1516.1±4.01ns 1551.6±5.84ns +2.34%
RegExp Literal (Execution) 12.7±0.02µs 12.6±0.09µs -0.79%
RegExp Literal (Parser) 8.0±0.01µs 8.0±0.03µs 0.00%
RegExp Literal Creation (Compiler) 1302.5±5.47ns 1340.4±3.55ns +2.91%
RegExp Literal Creation (Execution) 9.7±0.06µs 9.3±0.05µs -4.12%
RegExp Literal Creation (Parser) 6.3±0.01µs 6.3±0.01µs 0.00%
Static Object Property Access (Compiler) 1322.5±13.75ns 1385.5±8.37ns +4.76%
Static Object Property Access (Execution) 6.5±0.03µs 6.7±0.03µs +3.08%
Static Object Property Access (Parser) 9.9±0.20µs 9.9±0.05µs 0.00%
String Object Access (Compiler) 1370.7±4.94ns 1421.3±5.29ns +3.69%
String Object Access (Execution) 7.3±0.05µs 7.7±0.05µs +5.48%
String Object Access (Parser) 13.8±0.15µs 14.0±0.03µs +1.45%
String comparison (Compiler) 2.0±0.01µs 2.0±0.01µs 0.00%
String comparison (Execution) 6.0±0.03µs 6.3±0.04µs +5.00%
String comparison (Parser) 10.8±0.02µs 10.8±0.02µs 0.00%
String concatenation (Compiler) 1547.7±7.30ns 1590.8±3.26ns +2.78%
String concatenation (Execution) 5.4±0.02µs 5.6±0.01µs +3.70%
String concatenation (Parser) 7.4±0.02µs 7.5±0.02µs +1.35%
String copy (Compiler) 1189.3±3.39ns 1256.9±7.14ns +5.68%
String copy (Execution) 4.9±0.02µs 5.0±0.02µs +2.04%
String copy (Parser) 5.5±0.01µs 5.5±0.02µs 0.00%
Symbols (Compiler) 830.4±1.45ns 855.4±7.40ns +3.01%
Symbols (Execution) 4.8±0.02µs 4.9±0.02µs +2.08%
Symbols (Parser) 4.3±0.01µs 4.3±0.00µs 0.00%

boa/src/value/mod.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

Benchmark for 91d24cf

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 496.9±1.33ns 506.0±2.29ns +1.83%
Arithmetic operations (Execution) 1822.8±6.93ns 1893.8±1.30ns +3.90%
Arithmetic operations (Parser) 5.4±0.01µs 5.4±0.01µs 0.00%
Array access (Compiler) 1318.8±13.99ns 1307.4±2.41ns -0.86%
Array access (Execution) 10.3±0.04µs 10.5±0.04µs +1.94%
Array access (Parser) 12.4±0.08µs 12.5±0.06µs +0.81%
Array creation (Compiler) 1997.7±2.47ns 1982.4±4.60ns -0.77%
Array creation (Execution) 3.0±0.01ms 3.5±0.00ms +16.67%
Array creation (Parser) 13.9±0.05µs 13.9±0.03µs 0.00%
Array pop (Compiler) 3.8±0.01µs 3.7±0.02µs -2.63%
Array pop (Execution) 1323.4±4.70µs 1511.6±3.45µs +14.22%
Array pop (Parser) 137.6±0.24µs 136.8±0.15µs -0.58%
Boolean Object Access (Compiler) 1146.6±5.07ns 1153.0±4.20ns +0.56%
Boolean Object Access (Execution) 5.9±0.02µs 6.1±0.03µs +3.39%
Boolean Object Access (Parser) 14.7±0.42µs 14.4±0.21µs -2.04%
Clean js (Compiler) 3.7±0.02µs 3.6±0.01µs -2.70%
Clean js (Execution) 1086.7±7.43µs 1134.1±10.21µs +4.36%
Clean js (Parser) 30.1±0.19µs 29.8±0.13µs -1.00%
Create Realm 266.4±2.69ns 255.8±1.23ns -3.98%
Dynamic Object Property Access (Compiler) 1738.9±7.55ns 1731.0±7.39ns -0.45%
Dynamic Object Property Access (Execution) 6.8±0.07µs 7.0±0.04µs +2.94%
Dynamic Object Property Access (Parser) 11.0±0.09µs 11.3±0.02µs +2.73%
Fibonacci (Compiler) 2.4±0.01µs 2.4±0.01µs 0.00%
Fibonacci (Execution) 1832.4±3.19µs 1921.0±9.68µs +4.84%
Fibonacci (Parser) 16.5±0.05µs 16.8±0.09µs +1.82%
For loop (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
For loop (Execution) 40.6±0.13µs 40.7±0.15µs +0.25%
For loop (Parser) 14.3±0.07µs 14.4±0.08µs +0.70%
Mini js (Compiler) 3.6±0.01µs 3.5±0.01µs -2.78%
Mini js (Execution) 1001.4±9.19µs 1044.5±6.11µs +4.30%
Mini js (Parser) 26.4±0.14µs 26.2±0.07µs -0.76%
Number Object Access (Compiler) 1074.5±3.59ns 1081.6±4.88ns +0.66%
Number Object Access (Execution) 4.6±0.03µs 4.9±0.01µs +6.52%
Number Object Access (Parser) 11.3±0.02µs 11.2±0.01µs -0.88%
Object Creation (Compiler) 1438.8±3.81ns 1472.1±4.58ns +2.31%
Object Creation (Execution) 6.0±0.02µs 6.3±0.04µs +5.00%
Object Creation (Parser) 9.6±0.05µs 9.9±0.04µs +3.13%
RegExp (Compiler) 1705.3±8.39ns 1678.1±9.01ns -1.60%
RegExp (Execution) 12.7±0.05µs 12.7±0.03µs 0.00%
RegExp (Parser) 10.4±0.03µs 10.7±0.05µs +2.88%
RegExp Creation (Compiler) 1500.5±2.83ns 1470.5±5.89ns -2.00%
RegExp Creation (Execution) 9.4±0.03µs 9.5±0.05µs +1.06%
RegExp Creation (Parser) 8.8±0.04µs 8.9±0.02µs +1.14%
RegExp Literal (Compiler) 1699.2±6.03ns 1679.9±8.75ns -1.14%
RegExp Literal (Execution) 12.7±0.04µs 12.6±0.06µs -0.79%
RegExp Literal (Parser) 8.3±0.04µs 8.6±0.07µs +3.61%
RegExp Literal Creation (Compiler) 1488.2±3.72ns 1485.9±4.49ns -0.15%
RegExp Literal Creation (Execution) 9.4±0.03µs 9.5±0.04µs +1.06%
RegExp Literal Creation (Parser) 6.7±0.08µs 6.9±0.10µs +2.99%
Static Object Property Access (Compiler) 1503.2±3.77ns 1474.8±3.62ns -1.89%
Static Object Property Access (Execution) 6.4±0.02µs 6.6±0.02µs +3.12%
Static Object Property Access (Parser) 10.3±0.05µs 10.6±0.04µs +2.91%
String Object Access (Compiler) 1523.8±7.46ns 1511.0±6.86ns -0.84%
String Object Access (Execution) 8.0±0.07µs 8.3±0.07µs +3.75%
String Object Access (Parser) 14.2±0.01µs 14.1±0.02µs -0.70%
String comparison (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
String comparison (Execution) 5.9±0.02µs 6.5±0.04µs +10.17%
String comparison (Parser) 11.4±0.09µs 11.6±0.04µs +1.75%
String concatenation (Compiler) 1754.8±4.19ns 1724.4±6.73ns -1.73%
String concatenation (Execution) 5.4±0.02µs 5.7±0.02µs +5.56%
String concatenation (Parser) 7.9±0.05µs 7.9±0.01µs 0.00%
String copy (Compiler) 1370.5±5.91ns 1352.3±4.30ns -1.33%
String copy (Execution) 4.7±0.02µs 4.9±0.05µs +4.26%
String copy (Parser) 6.0±0.09µs 6.0±0.02µs 0.00%
Symbols (Compiler) 957.5±2.40ns 936.1±2.50ns -2.23%
Symbols (Execution) 4.6±0.03µs 4.8±0.03µs +4.35%
Symbols (Parser) 4.6±0.02µs 4.5±0.00µs -2.17%

@jedel1043
Copy link
Member

Didn't want to squash the commits but the rebase was pretty painful otherwise.

boa_engine/src/value/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/value/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/value/mod.rs Outdated Show resolved Hide resolved
@jedel1043
Copy link
Member

For now I undid returning refs. I'm thinking more carefully about how we can return refs without causing too much havoc, I'll make a PoC soon

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Benchmark for 09d99dd

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 612.9±4.45ns 626.5±7.03ns +2.22%
Arithmetic operations (Execution) 2.3±0.03µs 2.4±0.02µs +4.35%
Arithmetic operations (Parser) 5.8±0.25µs 5.6±0.10µs -3.45%
Array access (Compiler) 1479.2±20.65ns 1521.4±16.31ns +2.85%
Array access (Execution) 11.3±0.18µs 11.5±0.20µs +1.77%
Array access (Parser) 12.4±0.19µs 12.5±0.32µs +0.81%
Array creation (Compiler) 2.1±0.03µs 2.1±0.04µs 0.00%
Array creation (Execution) 4.0±0.16ms 4.8±0.16ms +20.00%
Array creation (Parser) 14.1±0.38µs 15.7±1.60µs +11.35%
Array pop (Compiler) 4.6±0.07µs 4.3±0.08µs -6.52%
Array pop (Execution) 1688.8±37.24µs 1967.2±29.70µs +16.49%
Array pop (Parser) 153.6±5.77µs 148.9±0.87µs -3.06%
Boolean Object Access (Compiler) 1153.6±17.21ns 1161.4±60.57ns +0.68%
Boolean Object Access (Execution) 6.9±0.08µs 7.1±0.30µs +2.90%
Boolean Object Access (Parser) 15.7±0.13µs 15.8±0.25µs +0.64%
Clean js (Compiler) 4.2±0.19µs 3.9±0.05µs -7.14%
Clean js (Execution) 1278.4±16.85µs 1377.6±75.11µs +7.76%
Clean js (Parser) 30.9±0.23µs 30.6±0.65µs -0.97%
Create Realm 308.6±5.55ns 332.4±15.25ns +7.71%
Dynamic Object Property Access (Compiler) 1862.7±22.15ns 2.0±0.11µs +7.37%
Dynamic Object Property Access (Execution) 8.0±0.08µs 8.1±0.08µs +1.25%
Dynamic Object Property Access (Parser) 10.9±0.20µs 11.3±0.36µs +3.67%
Fibonacci (Compiler) 2.6±0.01µs 2.7±0.05µs +3.85%
Fibonacci (Execution) 2.1±0.03ms 2.2±0.08ms +4.76%
Fibonacci (Parser) 17.4±0.25µs 17.2±0.35µs -1.15%
For loop (Compiler) 2.3±0.01µs 2.3±0.04µs 0.00%
For loop (Execution) 49.6±0.68µs 50.6±0.46µs +2.02%
For loop (Parser) 14.8±0.22µs 14.8±0.25µs 0.00%
Mini js (Compiler) 3.8±0.03µs 3.8±0.06µs 0.00%
Mini js (Execution) 1189.2±14.55µs 1213.6±17.17µs +2.05%
Mini js (Parser) 26.9±0.10µs 27.6±1.20µs +2.60%
Number Object Access (Compiler) 1098.0±14.42ns 1135.4±32.36ns +3.41%
Number Object Access (Execution) 5.7±0.22µs 5.5±0.06µs -3.51%
Number Object Access (Parser) 12.0±0.10µs 11.8±0.18µs -1.67%
Object Creation (Compiler) 1612.9±12.30ns 1672.1±25.45ns +3.67%
Object Creation (Execution) 7.1±0.13µs 7.7±0.43µs +8.45%
Object Creation (Parser) 9.8±0.08µs 9.9±0.09µs +1.02%
RegExp (Compiler) 1890.5±18.25ns 2.1±0.21µs +11.08%
RegExp (Execution) 14.4±0.34µs 13.9±0.32µs -3.47%
RegExp (Parser) 10.5±0.20µs 10.7±0.19µs +1.90%
RegExp Creation (Compiler) 1624.0±31.33ns 1696.2±18.59ns +4.45%
RegExp Creation (Execution) 11.6±0.55µs 10.8±0.11µs -6.90%
RegExp Creation (Parser) 8.8±0.18µs 8.9±0.16µs +1.14%
RegExp Literal (Compiler) 1941.6±80.49ns 2.0±0.11µs +3.01%
RegExp Literal (Execution) 14.6±0.23µs 14.9±0.60µs +2.05%
RegExp Literal (Parser) 8.4±0.14µs 8.5±0.21µs +1.19%
RegExp Literal Creation (Compiler) 1629.6±30.94ns 1690.0±25.05ns +3.71%
RegExp Literal Creation (Execution) 11.2±0.12µs 11.5±0.80µs +2.68%
RegExp Literal Creation (Parser) 6.7±0.10µs 7.1±0.29µs +5.97%
Static Object Property Access (Compiler) 1639.7±16.52ns 1724.8±50.48ns +5.19%
Static Object Property Access (Execution) 7.5±0.07µs 7.7±0.09µs +2.67%
Static Object Property Access (Parser) 10.3±0.19µs 11.1±0.59µs +7.77%
String Object Access (Compiler) 1588.8±19.65ns 1591.3±25.44ns +0.16%
String Object Access (Execution) 8.8±0.11µs 9.0±0.12µs +2.27%
String Object Access (Parser) 16.0±0.60µs 15.1±0.26µs -5.63%
String comparison (Compiler) 2.5±0.03µs 2.6±0.10µs +4.00%
String comparison (Execution) 6.8±0.07µs 7.5±0.28µs +10.29%
String comparison (Parser) 11.7±0.11µs 11.8±0.09µs +0.85%
String concatenation (Compiler) 1901.4±17.08ns 2.0±0.14µs +5.19%
String concatenation (Execution) 6.3±0.07µs 6.4±0.12µs +1.59%
String concatenation (Parser) 7.7±0.21µs 7.9±0.10µs +2.60%
String copy (Compiler) 1542.2±68.94ns 1595.3±26.37ns +3.44%
String copy (Execution) 5.5±0.07µs 5.7±0.07µs +3.64%
String copy (Parser) 5.9±0.09µs 6.0±0.27µs +1.69%
Symbols (Compiler) 1114.6±44.52ns 1164.2±56.09ns +4.45%
Symbols (Execution) 5.3±0.07µs 5.8±0.21µs +9.43%
Symbols (Parser) 4.5±0.09µs 4.6±0.15µs +2.22%

@HalidOdat
Copy link
Member Author

HalidOdat commented Mar 3, 2022

For now I undid returning refs. I'm thinking more carefully about how we can return refs without causing too much havoc, I'll make a PoC soon

The way I thought of doing it was by having a wrapper struct on ManuallyDrop.

#[derive(Debug)]
pub struct Ref<'a, T> {
    inner: ManuallyDrop<T>,
    _marker: PhantomData<&'a T>,
}

impl<T> Ref<'_, T> {
    #[inline]
    fn new(inner: ManuallyDrop<T>) -> Self {
        Self {
            inner,
            _marker: PhantomData,
        }
    }
}

impl<T> std::borrow::Borrow<T> for Ref<'_, T> {
    fn borrow(&self) -> &T {
        &*self.inner
    }
}

impl<T> AsRef<T> for Ref<'_, T> {
    fn as_ref(&self) -> &T {
        &*self.inner
    }
}

impl<T> std::ops::Deref for Ref<'_, T> {
    type Target = T;

    #[inline]
    fn deref(&self) -> &Self::Target {
        &*self.inner
    }
}

This struct must not implement Drop, since it would drop the JsValue. And anywhere we return &JsObject, &JsString, &JsSymbol and &JsBigInt we return a corresponding Ref<'_, T> type.

@jedel1043
Copy link
Member

Nice! Should I make a PR with the changes or do you plan on doing it?

@HalidOdat
Copy link
Member Author

Nice! Should I make a PR with the changes or do you plan on doing it?

Sure, you can do it if you want! :)
I'm going to be a bit busy this week, so don't think I'll have time to do it anyway 😅

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for 27ebfef

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 733.4±30.72ns 669.5±29.07ns -8.71%
Arithmetic operations (Execution) 2.5±0.13µs 2.3±0.12µs -8.00%
Arithmetic operations (Parser) 6.0±0.43µs 6.3±0.33µs +5.00%
Array access (Compiler) 1713.8±61.58ns 1738.7±73.41ns +1.45%
Array access (Execution) 12.5±0.43µs 11.8±0.74µs -5.60%
Array access (Parser) 13.3±0.83µs 14.8±0.93µs +11.28%
Array creation (Compiler) 2.5±0.14µs 2.4±0.13µs -4.00%
Array creation (Execution) 3.8±0.14ms 4.3±0.21ms +13.16%
Array creation (Parser) 15.4±0.93µs 16.1±0.45µs +4.55%
Array pop (Compiler) 4.7±0.31µs 4.6±0.25µs -2.13%
Array pop (Execution) 1569.4±68.97µs 1729.1±92.90µs +10.18%
Array pop (Parser) 156.2±15.51µs 171.8±9.62µs +9.99%
Boolean Object Access (Compiler) 1438.2±56.86ns 1383.3±90.64ns -3.82%
Boolean Object Access (Execution) 7.2±0.33µs 7.1±0.55µs -1.39%
Boolean Object Access (Parser) 16.1±0.97µs 16.9±0.76µs +4.97%
Clean js (Compiler) 4.6±0.21µs 4.5±0.63µs -2.17%
Clean js (Execution) 1307.2±60.98µs 1267.6±90.60µs -3.03%
Clean js (Parser) 33.4±1.87µs 34.0±2.08µs +1.80%
Create Realm 328.2±28.89ns 331.9±26.81ns +1.13%
Dynamic Object Property Access (Compiler) 2.2±0.12µs 2.2±0.10µs 0.00%
Dynamic Object Property Access (Execution) 8.6±0.43µs 9.0±0.43µs +4.65%
Dynamic Object Property Access (Parser) 11.6±0.74µs 12.4±0.64µs +6.90%
Fibonacci (Compiler) 2.9±0.19µs 3.1±0.14µs +6.90%
Fibonacci (Execution) 2.2±0.09ms 2.2±0.09ms 0.00%
Fibonacci (Parser) 18.5±0.98µs 19.8±1.15µs +7.03%
For loop (Compiler) 2.4±0.12µs 2.6±0.13µs +8.33%
For loop (Execution) 51.6±2.81µs 51.8±2.78µs +0.39%
For loop (Parser) 15.7±1.00µs 17.7±1.36µs +12.74%
Mini js (Compiler) 4.3±0.18µs 4.2±0.27µs -2.33%
Mini js (Execution) 1195.3±56.38µs 1193.5±69.42µs -0.15%
Mini js (Parser) 30.7±2.16µs 29.8±1.76µs -2.93%
Number Object Access (Compiler) 1377.0±57.37ns 1334.2±80.72ns -3.11%
Number Object Access (Execution) 5.7±0.24µs 5.5±0.30µs -3.51%
Number Object Access (Parser) 12.2±0.90µs 13.7±0.51µs +12.30%
Object Creation (Compiler) 1832.7±204.95ns 1872.9±84.99ns +2.19%
Object Creation (Execution) 8.0±0.28µs 7.9±0.30µs -1.25%
Object Creation (Parser) 10.4±0.56µs 11.6±0.78µs +11.54%
RegExp (Compiler) 2.3±0.22µs 2.2±0.11µs -4.35%
RegExp (Execution) 16.1±0.81µs 14.9±0.84µs -7.45%
RegExp (Parser) 11.0±0.84µs 11.7±0.64µs +6.36%
RegExp Creation (Compiler) 1967.2±118.95ns 1907.9±97.54ns -3.01%
RegExp Creation (Execution) 12.1±0.61µs 11.6±0.59µs -4.13%
RegExp Creation (Parser) 9.9±0.64µs 10.0±0.53µs +1.01%
RegExp Literal (Compiler) 2.2±0.09µs 2.2±0.09µs 0.00%
RegExp Literal (Execution) 16.2±0.71µs 15.5±1.10µs -4.32%
RegExp Literal (Parser) 9.6±0.84µs 9.6±0.52µs 0.00%
RegExp Literal Creation (Compiler) 2.0±0.15µs 1942.7±81.93ns -2.86%
RegExp Literal Creation (Execution) 12.0±0.76µs 11.9±0.80µs -0.83%
RegExp Literal Creation (Parser) 6.9±0.37µs 7.6±0.44µs +10.14%
Static Object Property Access (Compiler) 1962.7±126.53ns 1937.2±86.04ns -1.30%
Static Object Property Access (Execution) 8.1±0.48µs 8.3±0.37µs +2.47%
Static Object Property Access (Parser) 10.8±0.58µs 12.4±0.96µs +14.81%
String Object Access (Compiler) 1947.9±102.93ns 1884.9±130.52ns -3.23%
String Object Access (Execution) 9.4±0.48µs 9.5±0.51µs +1.06%
String Object Access (Parser) 16.0±1.04µs 16.6±0.60µs +3.75%
String comparison (Compiler) 2.9±0.20µs 2.8±0.20µs -3.45%
String comparison (Execution) 7.5±0.94µs 7.3±0.55µs -2.67%
String comparison (Parser) 12.2±0.74µs 12.9±0.63µs +5.74%
String concatenation (Compiler) 2.3±0.10µs 2.2±0.10µs -4.35%
String concatenation (Execution) 6.6±0.25µs 6.5±0.34µs -1.52%
String concatenation (Parser) 8.6±0.42µs 9.1±0.42µs +5.81%
String copy (Compiler) 1774.5±70.09ns 1752.6±68.62ns -1.23%
String copy (Execution) 6.3±0.27µs 5.9±0.38µs -6.35%
String copy (Parser) 6.2±0.34µs 6.6±0.33µs +6.45%
Symbols (Compiler) 1230.3±73.06ns 1305.8±72.20ns +6.14%
Symbols (Execution) 5.8±0.23µs 5.9±0.39µs +1.72%
Symbols (Parser) 5.0±0.39µs 5.5±0.57µs +10.00%

@jedel1043
Copy link
Member

Is there anything else missing?

@HalidOdat
Copy link
Member Author

Is there anything else missing?

Not sure, it should work. I'll debug it when I get some time this week :)

@github-actions
Copy link

github-actions bot commented Mar 7, 2022

Benchmark for ec8fdef

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 522.0±23.05ns 579.3±14.69ns +10.98%
Arithmetic operations (Execution) 1961.3±98.31ns 1937.0±96.84ns -1.24%
Arithmetic operations (Parser) 5.0±0.15µs 5.8±0.02µs +16.00%
Array access (Compiler) 1306.1±79.28ns 1455.0±22.10ns +11.40%
Array access (Execution) 10.1±0.43µs 9.3±0.44µs -7.92%
Array access (Parser) 11.4±0.46µs 11.2±0.29µs -1.75%
Array creation (Compiler) 2.0±0.06µs 2.0±0.06µs 0.00%
Array creation (Execution) 3.2±0.14ms 3.7±0.12ms +15.63%
Array creation (Parser) 13.2±0.81µs 13.6±0.44µs +3.03%
Array pop (Compiler) 4.5±0.15µs 4.4±0.12µs -2.22%
Array pop (Execution) 1459.1±44.01µs 1568.6±95.50µs +7.50%
Array pop (Parser) 140.3±6.09µs 132.1±4.14µs -5.84%
Boolean Object Access (Compiler) 1012.1±50.23ns 1068.4±35.79ns +5.56%
Boolean Object Access (Execution) 6.5±0.24µs 6.2±0.21µs -4.62%
Boolean Object Access (Parser) 13.1±0.62µs 15.6±0.03µs +19.08%
Clean js (Compiler) 3.3±0.16µs 3.6±0.14µs +9.09%
Clean js (Execution) 1101.5±59.19µs 1077.1±52.32µs -2.22%
Clean js (Parser) 24.9±0.90µs 30.9±0.59µs +24.10%
Create Realm 298.0±22.74ns 293.4±9.16ns -1.54%
Dynamic Object Property Access (Compiler) 1705.2±82.12ns 1846.9±26.58ns +8.31%
Dynamic Object Property Access (Execution) 7.0±0.19µs 7.0±0.42µs 0.00%
Dynamic Object Property Access (Parser) 9.8±0.41µs 9.8±0.22µs 0.00%
Fibonacci (Compiler) 2.4±0.10µs 2.7±0.04µs +12.50%
Fibonacci (Execution) 1775.9±99.65µs 1802.6±72.95µs +1.50%
Fibonacci (Parser) 15.4±0.55µs 16.5±0.53µs +7.14%
For loop (Compiler) 2.0±0.08µs 2.4±0.06µs +20.00%
For loop (Execution) 44.9±0.93µs 45.2±1.35µs +0.67%
For loop (Parser) 12.4±0.89µs 13.7±0.45µs +10.48%
Mini js (Compiler) 3.4±0.15µs 3.6±0.08µs +5.88%
Mini js (Execution) 1058.7±57.42µs 1004.3±34.76µs -5.14%
Mini js (Parser) 21.6±1.16µs 26.9±0.16µs +24.54%
Number Object Access (Compiler) 993.0±34.28ns 1023.0±38.07ns +3.02%
Number Object Access (Execution) 4.9±0.26µs 4.6±0.44µs -6.12%
Number Object Access (Parser) 10.6±0.44µs 11.9±0.02µs +12.26%
Object Creation (Compiler) 1420.5±48.97ns 1694.0±36.52ns +19.25%
Object Creation (Execution) 6.4±0.23µs 6.3±0.40µs -1.56%
Object Creation (Parser) 8.4±0.27µs 8.8±0.30µs +4.76%
RegExp (Compiler) 1721.1±55.77ns 1879.5±23.39ns +9.20%
RegExp (Execution) 12.2±0.82µs 11.7±0.75µs -4.10%
RegExp (Parser) 9.2±0.36µs 10.0±0.31µs +8.70%
RegExp Creation (Compiler) 1467.9±52.14ns 1597.5±26.59ns +8.83%
RegExp Creation (Execution) 9.5±0.43µs 8.7±0.50µs -8.42%
RegExp Creation (Parser) 7.6±0.39µs 7.8±0.20µs +2.63%
RegExp Literal (Compiler) 1721.9±67.46ns 1857.7±22.46ns +7.89%
RegExp Literal (Execution) 12.2±0.35µs 11.3±0.54µs -7.38%
RegExp Literal (Parser) 7.4±0.30µs 8.0±0.17µs +8.11%
RegExp Literal Creation (Compiler) 1462.7±38.43ns 1610.8±37.20ns +10.13%
RegExp Literal Creation (Execution) 9.1±0.29µs 8.9±0.59µs -2.20%
RegExp Literal Creation (Parser) 5.9±0.19µs 6.0±0.18µs +1.69%
Static Object Property Access (Compiler) 1497.6±74.50ns 1613.5±25.69ns +7.74%
Static Object Property Access (Execution) 6.7±0.20µs 6.6±0.35µs -1.49%
Static Object Property Access (Parser) 9.6±0.43µs 9.6±0.39µs 0.00%
String Object Access (Compiler) 1369.7±45.31ns 1464.5±49.50ns +6.92%
String Object Access (Execution) 8.3±0.45µs 7.1±0.37µs -14.46%
String Object Access (Parser) 13.3±0.49µs 15.2±0.02µs +14.29%
String comparison (Compiler) 2.2±0.05µs 2.3±0.08µs +4.55%
String comparison (Execution) 6.0±0.25µs 5.7±0.32µs -5.00%
String comparison (Parser) 10.5±0.36µs 10.5±0.32µs 0.00%
String concatenation (Compiler) 1664.3±63.00ns 1881.3±41.59ns +13.04%
String concatenation (Execution) 5.5±0.19µs 5.1±0.29µs -7.27%
String concatenation (Parser) 7.0±0.40µs 7.2±0.26µs +2.86%
String copy (Compiler) 1341.6±43.09ns 1466.6±43.51ns +9.32%
String copy (Execution) 4.6±0.23µs 4.9±0.32µs +6.52%
String copy (Parser) 5.1±0.12µs 5.9±0.14µs +15.69%
Symbols (Compiler) 968.8±29.92ns 1041.3±38.59ns +7.48%
Symbols (Execution) 4.7±0.14µs 5.0±0.15µs +6.38%
Symbols (Parser) 3.8±0.28µs 4.2±0.10µs +10.53%

@github-actions
Copy link

Benchmark for cc99501

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 471.1±1.34ns 477.3±1.31ns +1.32%
Arithmetic operations (Execution) 620.3±1.58ns 649.2±1.45ns +4.66%
Arithmetic operations (Parser) 5.6±0.02µs 5.6±0.02µs 0.00%
Array access (Compiler) 1280.2±3.19ns 1308.5±3.67ns +2.21%
Array access (Execution) 8.5±0.06µs 7.4±0.02µs -12.94%
Array access (Parser) 11.9±0.06µs 13.7±0.01µs +15.13%
Array creation (Compiler) 2.0±0.01µs 2.1±0.01µs +5.00%
Array creation (Execution) 2.3±0.00ms 2.4±0.00ms +4.35%
Array creation (Parser) 13.7±0.02µs 13.8±0.03µs +0.73%
Array pop (Compiler) 3.6±0.01µs 3.7±0.01µs +2.78%
Array pop (Execution) 1025.7±8.08µs 1068.2±5.87µs +4.14%
Array pop (Parser) 139.3±0.21µs 142.7±0.29µs +2.44%
Boolean Object Access (Compiler) 1012.8±3.43ns 1027.8±10.07ns +1.48%
Boolean Object Access (Execution) 3.8±0.02µs 3.8±0.01µs 0.00%
Boolean Object Access (Parser) 14.0±0.03µs 14.4±0.04µs +2.86%
Clean js (Compiler) 4.3±0.01µs 4.2±0.01µs -2.33%
Clean js (Execution) 637.2±2.91µs 642.0±5.67µs +0.75%
Clean js (Parser) 29.8±0.07µs 29.9±0.15µs +0.34%
Create Realm 246.5±0.61ns 248.0±0.36ns +0.61%
Dynamic Object Property Access (Compiler) 1640.2±6.12ns 1659.7±7.01ns +1.19%
Dynamic Object Property Access (Execution) 5.7±0.01µs 4.9±0.02µs -14.04%
Dynamic Object Property Access (Parser) 10.6±0.03µs 12.1±0.01µs +14.15%
Fibonacci (Compiler) 2.7±0.00µs 2.8±0.01µs +3.70%
Fibonacci (Execution) 1255.7±2.94µs 1248.9±4.56µs -0.54%
Fibonacci (Parser) 16.0±0.04µs 16.2±0.08µs +1.25%
For loop (Compiler) 2.6±0.01µs 2.3±0.01µs -11.54%
For loop (Execution) 14.6±0.04µs 14.9±0.08µs +2.05%
For loop (Parser) 14.1±0.03µs 14.1±0.02µs 0.00%
Mini js (Compiler) 4.3±0.01µs 3.8±0.01µs -11.63%
Mini js (Execution) 601.3±2.72µs 602.2±3.79µs +0.15%
Mini js (Parser) 26.0±0.05µs 26.3±0.05µs +1.15%
Number Object Access (Compiler) 965.3±5.05ns 971.1±6.41ns +0.60%
Number Object Access (Execution) 3.0±0.02µs 3.0±0.01µs 0.00%
Number Object Access (Parser) 11.0±0.07µs 11.1±0.03µs +0.91%
Object Creation (Compiler) 1598.4±4.40ns 1472.6±9.48ns -7.87%
Object Creation (Execution) 4.7±0.02µs 4.7±0.02µs 0.00%
Object Creation (Parser) 9.1±0.02µs 9.2±0.03µs +1.10%
RegExp (Compiler) 1612.8±5.38ns 1642.4±11.91ns +1.84%
RegExp (Execution) 12.7±0.09µs 11.2±0.05µs -11.81%
RegExp (Parser) 10.1±0.02µs 11.6±0.01µs +14.85%
RegExp Creation (Compiler) 1445.6±4.50ns 1437.8±6.87ns -0.54%
RegExp Creation (Execution) 9.6±0.03µs 8.5±0.03µs -11.46%
RegExp Creation (Parser) 8.4±0.02µs 9.6±0.01µs +14.29%
RegExp Literal (Compiler) 1595.2±5.30ns 1643.2±12.54ns +3.01%
RegExp Literal (Execution) 12.6±0.08µs 11.2±0.06µs -11.11%
RegExp Literal (Parser) 8.2±0.02µs 9.2±0.02µs +12.20%
RegExp Literal Creation (Compiler) 1413.3±2.92ns 1421.6±3.47ns +0.59%
RegExp Literal Creation (Execution) 9.6±0.03µs 8.5±0.03µs -11.46%
RegExp Literal Creation (Parser) 6.3±0.03µs 7.3±0.01µs +15.87%
Static Object Property Access (Compiler) 1653.5±4.32ns 1485.1±14.40ns -10.18%
Static Object Property Access (Execution) 4.9±0.02µs 4.8±0.02µs -2.04%
Static Object Property Access (Parser) 9.8±0.02µs 11.2±0.03µs +14.29%
String Object Access (Compiler) 1338.8±4.02ns 1390.2±9.11ns +3.84%
String Object Access (Execution) 5.7±0.03µs 5.5±0.01µs -3.51%
String Object Access (Parser) 13.9±0.03µs 14.1±0.02µs +1.44%
String comparison (Compiler) 2.0±0.00µs 2.1±0.01µs +5.00%
String comparison (Execution) 4.2±0.01µs 4.2±0.01µs 0.00%
String comparison (Parser) 10.9±0.04µs 10.9±0.03µs 0.00%
String concatenation (Compiler) 1596.7±6.43ns 1650.6±10.44ns +3.38%
String concatenation (Execution) 4.1±0.02µs 4.0±0.02µs -2.44%
String concatenation (Parser) 7.7±0.03µs 7.6±0.02µs -1.30%
String copy (Compiler) 1348.1±4.07ns 1366.8±9.91ns +1.39%
String copy (Execution) 3.8±0.02µs 3.7±0.02µs -2.63%
String copy (Parser) 6.5±0.02µs 5.7±0.02µs -12.31%
Symbols (Compiler) 988.6±9.41ns 995.9±3.60ns +0.74%
Symbols (Execution) 3.9±0.01µs 3.9±0.01µs 0.00%
Symbols (Parser) 5.0±0.01µs 4.5±0.01µs -10.00%

@jedel1043
Copy link
Member

jedel1043 commented May 28, 2022

OK, this is pretty much ready, I think. It's feature gated, JsValue doesn't implement Send anymore and all methods are properly documented.

@jedel1043 jedel1043 marked this pull request as ready for review May 28, 2022 01:52
@github-actions
Copy link

Benchmark for 0d9ef33

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 708.4±32.81ns 672.1±44.04ns -5.12%
Arithmetic operations (Execution) 694.4±56.21ns 752.3±46.65ns +8.34%
Arithmetic operations (Parser) 7.1±0.46µs 7.2±0.61µs +1.41%
Array access (Compiler) 2.0±0.12µs 1988.7±129.97ns -0.56%
Array access (Execution) 9.8±0.63µs 9.9±0.54µs +1.02%
Array access (Parser) 14.8±0.99µs 14.8±1.01µs 0.00%
Array creation (Compiler) 2.8±0.19µs 2.9±0.15µs +3.57%
Array creation (Execution) 2.9±0.17ms 2.9±0.17ms 0.00%
Array creation (Parser) 17.4±1.24µs 17.6±1.33µs +1.15%
Array pop (Compiler) 4.7±0.38µs 5.2±0.33µs +10.64%
Array pop (Execution) 1244.1±63.50µs 1340.0±97.22µs +7.71%
Array pop (Parser) 174.1±11.50µs 156.9±13.23µs -9.88%
Boolean Object Access (Compiler) 1491.4±85.56ns 1429.0±80.51ns -4.18%
Boolean Object Access (Execution) 5.2±0.43µs 5.2±0.36µs 0.00%
Boolean Object Access (Parser) 18.4±1.49µs 17.7±1.59µs -3.80%
Clean js (Compiler) 6.1±0.37µs 5.9±0.29µs -3.28%
Clean js (Execution) 811.8±49.69µs 834.1±53.02µs +2.75%
Clean js (Parser) 39.5±2.70µs 37.8±2.93µs -4.30%
Create Realm 269.6±16.27ns 263.5±18.89ns -2.26%
Dynamic Object Property Access (Compiler) 2.4±0.11µs 2.3±0.16µs -4.17%
Dynamic Object Property Access (Execution) 6.9±0.54µs 6.7±0.57µs -2.90%
Dynamic Object Property Access (Parser) 13.1±0.76µs 13.4±1.05µs +2.29%
Fibonacci (Compiler) 3.5±0.22µs 3.4±0.23µs -2.86%
Fibonacci (Execution) 1712.5±103.77µs 1649.5±87.89µs -3.68%
Fibonacci (Parser) 20.3±1.31µs 20.3±1.39µs 0.00%
For loop (Compiler) 3.3±0.23µs 3.1±0.29µs -6.06%
For loop (Execution) 19.7±1.35µs 19.6±1.91µs -0.51%
For loop (Parser) 17.2±1.20µs 17.7±2.19µs +2.91%
Mini js (Compiler) 5.3±0.34µs 5.1±0.35µs -3.77%
Mini js (Execution) 738.9±64.21µs 759.8±57.33µs +2.83%
Mini js (Parser) 33.7±2.81µs 32.2±1.78µs -4.45%
Number Object Access (Compiler) 1348.0±110.63ns 1355.1±72.68ns +0.53%
Number Object Access (Execution) 3.9±0.26µs 4.2±0.28µs +7.69%
Number Object Access (Parser) 14.1±1.22µs 14.2±1.07µs +0.71%
Object Creation (Compiler) 1988.3±180.12ns 2.0±0.15µs +0.59%
Object Creation (Execution) 6.5±0.33µs 6.3±0.35µs -3.08%
Object Creation (Parser) 12.0±1.04µs 11.4±0.86µs -5.00%
RegExp (Compiler) 2.2±0.19µs 2.3±0.09µs +4.55%
RegExp (Execution) 15.3±1.07µs 14.5±0.80µs -5.23%
RegExp (Parser) 12.6±0.90µs 12.5±0.89µs -0.79%
RegExp Creation (Compiler) 2.0±0.14µs 2.1±0.07µs +5.00%
RegExp Creation (Execution) 11.3±0.73µs 10.6±0.54µs -6.19%
RegExp Creation (Parser) 11.0±0.82µs 10.5±0.88µs -4.55%
RegExp Literal (Compiler) 2.5±0.30µs 2.4±0.12µs -4.00%
RegExp Literal (Execution) 15.3±1.34µs 14.5±0.92µs -5.23%
RegExp Literal (Parser) 10.5±0.82µs 10.3±0.80µs -1.90%
RegExp Literal Creation (Compiler) 2.1±0.14µs 2.1±0.15µs 0.00%
RegExp Literal Creation (Execution) 11.2±0.72µs 11.0±0.58µs -1.79%
RegExp Literal Creation (Parser) 7.9±0.55µs 7.9±0.46µs 0.00%
Static Object Property Access (Compiler) 1983.0±93.96ns 2.0±0.13µs +0.86%
Static Object Property Access (Execution) 6.7±0.51µs 6.4±0.43µs -4.48%
Static Object Property Access (Parser) 12.9±0.96µs 12.2±0.74µs -5.43%
String Object Access (Compiler) 1821.6±90.01ns 1800.8±85.26ns -1.14%
String Object Access (Execution) 7.6±0.48µs 7.9±0.44µs +3.95%
String Object Access (Parser) 17.1±0.98µs 18.3±1.89µs +7.02%
String comparison (Compiler) 2.9±0.29µs 3.0±0.16µs +3.45%
String comparison (Execution) 5.8±0.28µs 5.6±0.34µs -3.45%
String comparison (Parser) 13.7±1.02µs 13.6±1.16µs -0.73%
String concatenation (Compiler) 2.3±0.19µs 2.4±0.12µs +4.35%
String concatenation (Execution) 5.4±0.35µs 5.4±0.34µs 0.00%
String concatenation (Parser) 9.7±0.66µs 9.2±0.58µs -5.15%
String copy (Compiler) 1876.1±116.08ns 1916.6±107.84ns +2.16%
String copy (Execution) 5.6±0.58µs 5.2±0.46µs -7.14%
String copy (Parser) 7.3±0.53µs 7.0±0.49µs -4.11%
Symbols (Compiler) 1479.6±135.83ns 1428.3±85.43ns -3.47%
Symbols (Execution) 5.3±0.32µs 5.3±0.33µs 0.00%
Symbols (Parser) 5.5±0.34µs 5.7±0.45µs +3.64%

Copy link
Member Author

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

@github-actions
Copy link

github-actions bot commented Jun 7, 2022

Benchmark for 2d419b1

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 633.5±7.81ns 658.4±9.06ns +3.93%
Arithmetic operations (Execution) 791.7±8.58ns 804.3±26.41ns +1.59%
Arithmetic operations (Parser) 6.4±0.10µs 6.2±0.21µs -3.13%
Array access (Compiler) 1684.8±24.14ns 1614.1±52.14ns -4.20%
Array access (Execution) 9.4±0.13µs 9.3±0.25µs -1.06%
Array access (Parser) 14.1±0.20µs 14.1±0.30µs 0.00%
Array creation (Compiler) 2.6±0.03µs 2.4±0.09µs -7.69%
Array creation (Execution) 3.1±0.04ms 3.1±0.05ms 0.00%
Array creation (Parser) 16.5±0.23µs 16.3±0.28µs -1.21%
Array pop (Compiler) 4.8±0.06µs 4.6±0.17µs -4.17%
Array pop (Execution) 1402.0±25.89µs 1419.8±31.38µs +1.27%
Array pop (Parser) 163.1±1.21µs 157.2±2.69µs -3.62%
Boolean Object Access (Compiler) 1207.7±29.62ns 1207.9±31.44ns +0.02%
Boolean Object Access (Execution) 5.0±0.07µs 5.0±0.10µs 0.00%
Boolean Object Access (Parser) 17.3±0.24µs 16.2±0.57µs -6.36%
Clean js (Compiler) 5.4±0.05µs 5.5±0.06µs +1.85%
Clean js (Execution) 842.3±9.55µs 849.2±20.09µs +0.82%
Clean js (Parser) 35.4±0.48µs 34.5±1.34µs -2.54%
Create Realm 269.1±3.28ns 262.1±8.29ns -2.60%
Dynamic Object Property Access (Compiler) 1990.3±27.65ns 1919.4±63.35ns -3.56%
Dynamic Object Property Access (Execution) 6.3±0.08µs 6.0±0.23µs -4.76%
Dynamic Object Property Access (Parser) 12.8±0.05µs 12.9±0.10µs +0.78%
Fibonacci (Compiler) 3.1±0.03µs 2.9±0.11µs -6.45%
Fibonacci (Execution) 1520.1±14.51µs 1503.7±42.52µs -1.08%
Fibonacci (Parser) 19.5±0.31µs 19.1±0.41µs -2.05%
For loop (Compiler) 2.9±0.04µs 2.7±0.10µs -6.90%
For loop (Execution) 18.9±0.18µs 19.2±0.30µs +1.59%
For loop (Parser) 17.1±0.23µs 17.0±0.37µs -0.58%
Mini js (Compiler) 4.7±0.06µs 4.7±0.10µs 0.00%
Mini js (Execution) 807.9±5.93µs 827.3±4.31µs +2.40%
Mini js (Parser) 30.9±0.45µs 30.5±1.15µs -1.29%
Number Object Access (Compiler) 1152.6±14.00ns 1148.3±20.59ns -0.37%
Number Object Access (Execution) 3.9±0.04µs 3.8±0.12µs -2.56%
Number Object Access (Parser) 13.6±0.12µs 13.3±0.28µs -2.21%
Object Creation (Compiler) 1821.3±13.09ns 1663.2±55.28ns -8.68%
Object Creation (Execution) 5.9±0.05µs 5.6±0.19µs -5.08%
Object Creation (Parser) 11.0±0.16µs 11.1±0.19µs +0.91%
RegExp (Compiler) 1997.5±24.61ns 1886.4±52.43ns -5.56%
RegExp (Execution) 13.7±0.18µs 13.7±0.30µs 0.00%
RegExp (Parser) 12.1±0.17µs 12.0±0.25µs -0.83%
RegExp Creation (Compiler) 1789.2±19.84ns 1716.2±60.59ns -4.08%
RegExp Creation (Execution) 10.7±0.13µs 10.2±0.18µs -4.67%
RegExp Creation (Parser) 10.3±0.06µs 10.3±0.13µs 0.00%
RegExp Literal (Compiler) 2.0±0.01µs 1936.7±44.45ns -3.16%
RegExp Literal (Execution) 13.7±0.17µs 13.5±0.38µs -1.46%
RegExp Literal (Parser) 9.9±0.16µs 10.0±0.05µs +1.01%
RegExp Literal Creation (Compiler) 1796.6±27.12ns 1725.1±58.55ns -3.98%
RegExp Literal Creation (Execution) 10.7±0.14µs 10.0±0.33µs -6.54%
RegExp Literal Creation (Parser) 7.6±0.13µs 7.6±0.16µs 0.00%
Static Object Property Access (Compiler) 1806.4±26.79ns 1674.4±52.89ns -7.31%
Static Object Property Access (Execution) 6.1±0.10µs 5.8±0.17µs -4.92%
Static Object Property Access (Parser) 12.0±0.15µs 12.0±0.21µs 0.00%
String Object Access (Compiler) 1544.1±26.35ns 1534.4±32.44ns -0.63%
String Object Access (Execution) 7.2±0.10µs 6.8±0.19µs -5.56%
String Object Access (Parser) 16.9±0.37µs 16.6±0.53µs -1.78%
String comparison (Compiler) 2.6±0.03µs 2.5±0.10µs -3.85%
String comparison (Execution) 5.2±0.07µs 5.2±0.12µs 0.00%
String comparison (Parser) 13.3±0.11µs 12.9±0.26µs -3.01%
String concatenation (Compiler) 2.0±0.02µs 1878.0±56.13ns -6.10%
String concatenation (Execution) 5.0±0.07µs 4.9±0.12µs -2.00%
String concatenation (Parser) 9.2±0.07µs 8.9±0.16µs -3.26%
String copy (Compiler) 1657.9±22.14ns 1587.6±49.02ns -4.24%
String copy (Execution) 4.7±0.06µs 4.8±0.10µs +2.13%
String copy (Parser) 6.8±0.08µs 6.6±0.12µs -2.94%
Symbols (Compiler) 1255.7±8.65ns 1255.3±17.79ns -0.03%
Symbols (Execution) 4.8±0.04µs 4.8±0.14µs 0.00%
Symbols (Parser) 5.3±0.06µs 5.2±0.17µs -1.89%

@Razican Razican modified the milestones: v0.15.0, v0.16.0 Jun 7, 2022
@Razican
Copy link
Member

Razican commented Jun 7, 2022

Moving it for 0.16 to give some time for deeper reviewing, as discussed in Discord.

@jedel1043
Copy link
Member

Moving to 0.17, because I had a slightly safer API using a JsValue trait with GATs, and apparently they're about to be stabilized. rust-lang/rust#96709

@jedel1043 jedel1043 modified the milestones: v0.16.0, v0.17.0 Sep 3, 2022
@jedel1043 jedel1043 marked this pull request as draft September 8, 2022 18:39
@jedel1043 jedel1043 added run-benchmark Label used to run banchmarks on PRs and removed run-benchmark Label used to run banchmarks on PRs labels Sep 8, 2022
@Razican Razican modified the milestones: v0.17.0, v0.18.0 Jul 8, 2023
@jedel1043
Copy link
Member

jedel1043 commented Nov 29, 2023

Blocked since we want to first abstract JsValue so that we can modify its internal repr without changing the public API.

@jedel1043 jedel1043 added the blocked Waiting for another code change label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Waiting for another code change execution Issues or PRs related to code execution performance Performance related changes and issues technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NaN boxed JavaScript Value
3 participants