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

[Merged by Bors] - Added conversions from and to serde_json's Value type #1851

Closed
wants to merge 6 commits into from

Conversation

Razican
Copy link
Member

@Razican Razican commented Feb 20, 2022

This Pull Request closes #1693.

It changes the following:

  • It adds a fallible conversion from serde_json::Value to JsValue, which requires a context.
  • It adds a fallible conversion from JsValue to serde_json::Value, which requires a context.
  • Added examples to the documentation of both methods.
  • Removed some duplicate and non-needed code that I found while doing this.

@Razican Razican added enhancement New feature or request API labels Feb 20, 2022
@Razican Razican added this to the v0.14.0 milestone Feb 20, 2022
@github-actions
Copy link

github-actions bot commented Feb 20, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 88,342 88,342 0
Passed 41,386 41,386 0
Ignored 21,413 21,413 0
Failed 25,543 25,543 0
Panics 12 12 0
Conformance 46.85% 46.85% 0.00%

@codecov
Copy link

codecov bot commented Feb 20, 2022

Codecov Report

Merging #1851 (e96cbd1) into main (4d2772d) will increase coverage by 0.19%.
The diff coverage is 88.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1851      +/-   ##
==========================================
+ Coverage   56.09%   56.29%   +0.19%     
==========================================
  Files         200      201       +1     
  Lines       17901    17936      +35     
==========================================
+ Hits        10042    10097      +55     
+ Misses       7859     7839      -20     
Impacted Files Coverage Δ
boa_engine/src/value/conversions.rs 79.54% <ø> (+3.45%) ⬆️
boa_engine/src/value/mod.rs 58.68% <ø> (ø)
boa_engine/src/value/serde_json.rs 86.53% <86.53%> (ø)
boa_engine/src/object/mod.rs 29.59% <100.00%> (+0.39%) ⬆️
boa_engine/src/builtins/array/mod.rs 78.87% <0.00%> (+1.06%) ⬆️
boa_engine/src/object/jsarray.rs 5.61% <0.00%> (+5.61%) ⬆️

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 4d2772d...e96cbd1. Read the comment docs.

@github-actions
Copy link

Benchmark for f680474

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 646.5±28.74ns 627.6±24.65ns -2.92%
Arithmetic operations (Execution) 2.3±0.11µs 2.5±0.13µs +8.70%
Arithmetic operations (Parser) 6.7±0.38µs 6.5±0.39µs -2.99%
Array access (Compiler) 1595.1±55.22ns 1662.3±98.09ns +4.21%
Array access (Execution) 12.7±0.54µs 13.6±0.47µs +7.09%
Array access (Parser) 13.6±0.54µs 13.9±1.39µs +2.21%
Array creation (Compiler) 2.3±0.07µs 2.4±0.11µs +4.35%
Array creation (Execution) 3.8±0.18ms 3.6±0.10ms -5.26%
Array creation (Parser) 15.0±0.68µs 15.0±0.74µs 0.00%
Array pop (Compiler) 4.4±0.13µs 4.2±0.23µs -4.55%
Array pop (Execution) 1609.2±86.66µs 1615.1±88.05µs +0.37%
Array pop (Parser) 161.3±7.00µs 184.3±11.74µs +14.26%
Boolean Object Access (Compiler) 1270.0±46.88ns 1320.8±58.60ns +4.00%
Boolean Object Access (Execution) 6.9±0.29µs 6.9±0.40µs 0.00%
Boolean Object Access (Parser) 15.9±0.71µs 15.5±0.68µs -2.52%
Clean js (Compiler) 4.3±0.30µs 4.2±0.24µs -2.33%
Clean js (Execution) 1362.0±58.03µs 1262.8±54.58µs -7.28%
Clean js (Parser) 32.4±1.73µs 32.7±1.61µs +0.93%
Create Realm 348.5±9.33ns 337.5±9.53ns -3.16%
Dynamic Object Property Access (Compiler) 2.1±0.20µs 2.0±0.10µs -4.76%
Dynamic Object Property Access (Execution) 9.0±0.28µs 9.3±0.43µs +3.33%
Dynamic Object Property Access (Parser) 13.0±0.50µs 12.1±0.56µs -6.92%
Fibonacci (Compiler) 2.8±0.09µs 2.9±0.16µs +3.57%
Fibonacci (Execution) 3.7±0.10ms 3.6±0.13ms -2.70%
Fibonacci (Parser) 19.7±0.45µs 18.6±0.68µs -5.58%
For loop (Compiler) 2.3±0.14µs 2.4±0.10µs +4.35%
For loop (Execution) 55.9±2.24µs 52.1±2.15µs -6.80%
For loop (Parser) 16.6±0.77µs 16.5±0.45µs -0.60%
Mini js (Compiler) 4.2±0.24µs 4.0±0.25µs -4.76%
Mini js (Execution) 1242.5±61.46µs 1208.8±230.42µs -2.71%
Mini js (Parser) 28.4±1.15µs 29.2±1.54µs +2.82%
Number Object Access (Compiler) 1251.1±68.96ns 1241.1±43.76ns -0.80%
Number Object Access (Execution) 5.3±0.23µs 5.3±0.20µs 0.00%
Number Object Access (Parser) 12.4±0.45µs 12.5±0.69µs +0.81%
Object Creation (Compiler) 1699.0±81.29ns 1745.7±59.16ns +2.75%
Object Creation (Execution) 8.2±0.20µs 7.9±0.35µs -3.66%
Object Creation (Parser) 11.4±0.52µs 10.8±0.40µs -5.26%
RegExp (Compiler) 2.0±0.05µs 2.1±0.10µs +5.00%
RegExp (Execution) 15.3±0.70µs 15.5±0.68µs +1.31%
RegExp (Parser) 11.4±0.66µs 11.3±0.47µs -0.88%
RegExp Creation (Compiler) 1762.3±56.73ns 1809.4±102.24ns +2.67%
RegExp Creation (Execution) 11.8±0.49µs 11.4±0.48µs -3.39%
RegExp Creation (Parser) 9.5±0.45µs 9.2±0.50µs -3.16%
RegExp Literal (Compiler) 2.1±0.06µs 2.0±0.08µs -4.76%
RegExp Literal (Execution) 15.8±0.97µs 15.1±0.49µs -4.43%
RegExp Literal (Parser) 9.1±0.49µs 9.2±0.36µs +1.10%
RegExp Literal Creation (Compiler) 1816.7±90.23ns 1826.5±86.25ns +0.54%
RegExp Literal Creation (Execution) 12.1±0.41µs 11.3±0.55µs -6.61%
RegExp Literal Creation (Parser) 7.8±0.44µs 7.0±0.34µs -10.26%
Static Object Property Access (Compiler) 1698.7±76.55ns 1889.9±65.54ns +11.26%
Static Object Property Access (Execution) 8.5±0.26µs 8.1±0.31µs -4.71%
Static Object Property Access (Parser) 11.9±0.42µs 11.2±0.80µs -5.88%
String Object Access (Compiler) 1697.6±96.92ns 1775.8±99.98ns +4.61%
String Object Access (Execution) 8.9±0.41µs 9.0±0.45µs +1.12%
String Object Access (Parser) 16.6±0.51µs 15.4±0.67µs -7.23%
String comparison (Compiler) 2.7±0.08µs 2.6±0.09µs -3.70%
String comparison (Execution) 7.6±0.55µs 7.6±0.32µs 0.00%
String comparison (Parser) 12.4±0.63µs 12.1±0.62µs -2.42%
String concatenation (Compiler) 2.1±0.13µs 2.1±0.14µs 0.00%
String concatenation (Execution) 7.1±0.33µs 6.9±0.30µs -2.82%
String concatenation (Parser) 9.2±0.26µs 8.2±0.50µs -10.87%
String copy (Compiler) 1574.0±49.14ns 1671.3±66.64ns +6.18%
String copy (Execution) 6.4±0.28µs 6.4±0.33µs 0.00%
String copy (Parser) 6.2±0.22µs 6.1±0.22µs -1.61%
Symbols (Compiler) 1113.0±36.56ns 1178.5±48.93ns +5.88%
Symbols (Execution) 6.5±0.60µs 6.4±0.39µs -1.54%
Symbols (Parser) 5.2±0.14µs 5.1±0.23µs -1.92%

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Great! This should be pretty useful for users of serde_json :D

boa/src/value/serde_json.rs Outdated Show resolved Hide resolved
boa/src/value/serde_json.rs Outdated Show resolved Hide resolved
@jedel1043
Copy link
Member

Also, I think some module tests would be good to ensure conversions work OK

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.

Nothing to add besides @jedel1043's notes

@Razican
Copy link
Member Author

Razican commented Feb 21, 2022

Also, I think some module tests would be good to ensure conversions work OK

I wrote the fixes and added a pretty deep test. Hopefully this should solve most situations.

@github-actions
Copy link

Benchmark for 6081edf

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 474.7±1.23ns 465.4±1.44ns -1.96%
Arithmetic operations (Execution) 2.0±0.00µs 2.0±0.00µs 0.00%
Arithmetic operations (Parser) 5.5±0.00µs 5.5±0.01µs 0.00%
Array access (Compiler) 1192.1±4.66ns 1196.7±8.61ns +0.39%
Array access (Execution) 10.1±0.05µs 10.1±0.05µs 0.00%
Array access (Parser) 11.8±0.02µs 11.8±0.01µs 0.00%
Array creation (Compiler) 1736.0±4.52ns 1717.4±5.90ns -1.07%
Array creation (Execution) 3.1±0.00ms 3.1±0.00ms 0.00%
Array creation (Parser) 13.2±0.03µs 13.3±0.03µs +0.76%
Array pop (Compiler) 3.5±0.01µs 3.4±0.02µs -2.86%
Array pop (Execution) 1321.7±3.91µs 1338.9±4.20µs +1.30%
Array pop (Parser) 137.1±0.12µs 136.4±0.21µs -0.51%
Boolean Object Access (Compiler) 1033.0±4.96ns 1024.6±2.48ns -0.81%
Boolean Object Access (Execution) 5.6±0.01µs 5.7±0.04µs +1.79%
Boolean Object Access (Parser) 14.0±0.02µs 14.2±0.02µs +1.43%
Clean js (Compiler) 3.2±0.01µs 3.2±0.02µs 0.00%
Clean js (Execution) 1083.2±5.95µs 1086.4±6.36µs +0.30%
Clean js (Parser) 28.6±0.03µs 28.6±0.03µs 0.00%
Create Realm 270.6±0.28ns 270.8±0.28ns +0.07%
Dynamic Object Property Access (Compiler) 1534.4±2.75ns 1512.2±3.54ns -1.45%
Dynamic Object Property Access (Execution) 6.7±0.03µs 6.6±0.02µs -1.49%
Dynamic Object Property Access (Parser) 10.5±0.02µs 10.6±0.03µs +0.95%
Fibonacci (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 1796.6±3.67µs 1782.0±3.29µs -0.81%
Fibonacci (Parser) 15.8±0.04µs 16.0±0.02µs +1.27%
For loop (Compiler) 1843.0±3.68ns 1811.2±5.02ns -1.73%
For loop (Execution) 42.1±0.16µs 42.2±0.13µs +0.24%
For loop (Parser) 13.7±0.03µs 13.7±0.02µs 0.00%
Mini js (Compiler) 3.1±0.01µs 3.2±0.02µs +3.23%
Mini js (Execution) 1000.0±4.98µs 1002.7±11.76µs +0.27%
Mini js (Parser) 25.1±0.04µs 25.0±0.04µs -0.40%
Number Object Access (Compiler) 987.2±1.35ns 978.8±1.33ns -0.85%
Number Object Access (Execution) 4.5±0.03µs 4.4±0.01µs -2.22%
Number Object Access (Parser) 11.0±0.01µs 11.1±0.01µs +0.91%
Object Creation (Compiler) 1320.4±2.21ns 1284.2±2.43ns -2.74%
Object Creation (Execution) 6.0±0.01µs 6.0±0.01µs 0.00%
Object Creation (Parser) 9.1±0.02µs 9.2±0.02µs +1.10%
RegExp (Compiler) 1557.1±2.50ns 1570.8±14.70ns +0.88%
RegExp (Execution) 12.1±0.10µs 12.0±0.06µs -0.83%
RegExp (Parser) 10.0±0.02µs 9.9±0.01µs -1.00%
RegExp Creation (Compiler) 1330.5±3.18ns 1325.3±3.01ns -0.39%
RegExp Creation (Execution) 9.1±0.03µs 9.0±0.04µs -1.10%
RegExp Creation (Parser) 8.3±0.03µs 8.3±0.02µs 0.00%
RegExp Literal (Compiler) 1555.7±2.65ns 1552.4±13.01ns -0.21%
RegExp Literal (Execution) 12.2±0.06µs 12.0±0.06µs -1.64%
RegExp Literal (Parser) 8.0±0.02µs 8.0±0.01µs 0.00%
RegExp Literal Creation (Compiler) 1328.5±3.02ns 1330.8±3.41ns +0.17%
RegExp Literal Creation (Execution) 9.1±0.02µs 9.0±0.02µs -1.10%
RegExp Literal Creation (Parser) 6.4±0.01µs 6.4±0.01µs 0.00%
Static Object Property Access (Compiler) 1314.9±1.91ns 1310.4±1.63ns -0.34%
Static Object Property Access (Execution) 6.3±0.04µs 6.2±0.02µs -1.59%
Static Object Property Access (Parser) 9.7±0.02µs 9.8±0.02µs +1.03%
String Object Access (Compiler) 1381.1±5.05ns 1429.3±10.41ns +3.49%
String Object Access (Execution) 7.5±0.03µs 7.6±0.09µs +1.33%
String Object Access (Parser) 13.8±0.01µs 13.9±0.01µs +0.72%
String comparison (Compiler) 2.0±0.02µs 2.0±0.00µs 0.00%
String comparison (Execution) 5.9±0.01µs 5.8±0.01µs -1.69%
String comparison (Parser) 10.9±0.02µs 10.9±0.02µs 0.00%
String concatenation (Compiler) 1568.1±11.90ns 1532.9±3.09ns -2.24%
String concatenation (Execution) 5.3±0.02µs 5.2±0.02µs -1.89%
String concatenation (Parser) 7.4±0.01µs 7.5±0.02µs +1.35%
String copy (Compiler) 1237.2±8.78ns 1233.2±5.50ns -0.32%
String copy (Execution) 4.7±0.01µs 4.7±0.01µs 0.00%
String copy (Parser) 5.6±0.01µs 5.6±0.02µs 0.00%
Symbols (Compiler) 881.5±25.68ns 832.6±3.92ns -5.55%
Symbols (Execution) 4.5±0.01µs 4.4±0.02µs -2.22%
Symbols (Parser) 4.3±0.01µs 4.3±0.00µs 0.00%

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

Benchmark for 12bac5e

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 393.6±6.97ns 414.9±2.83ns +5.41%
Arithmetic operations (Execution) 1787.9±27.87ns 1740.1±28.53ns -2.67%
Arithmetic operations (Parser) 4.7±0.08µs 4.7±0.09µs 0.00%
Array access (Compiler) 1009.7±16.86ns 1032.0±18.12ns +2.21%
Array access (Execution) 9.0±0.03µs 9.0±0.08µs 0.00%
Array access (Parser) 10.1±0.21µs 10.1±0.14µs 0.00%
Array creation (Compiler) 1500.0±27.12ns 1476.6±21.60ns -1.56%
Array creation (Execution) 2.7±0.00ms 2.7±0.02ms 0.00%
Array creation (Parser) 11.4±0.16µs 11.3±0.19µs -0.88%
Array pop (Compiler) 2.9±0.06µs 2.9±0.06µs 0.00%
Array pop (Execution) 1163.6±3.58µs 1170.8±9.01µs +0.62%
Array pop (Parser) 117.6±1.98µs 116.7±2.22µs -0.77%
Boolean Object Access (Compiler) 878.8±17.23ns 919.1±10.11ns +4.59%
Boolean Object Access (Execution) 5.0±0.01µs 4.7±0.06µs -6.00%
Boolean Object Access (Parser) 12.1±0.20µs 12.0±0.18µs -0.83%
Clean js (Compiler) 2.8±0.06µs 2.9±0.04µs +3.57%
Clean js (Execution) 952.5±4.21µs 954.6±5.98µs +0.22%
Clean js (Parser) 24.4±0.36µs 24.2±0.28µs -0.82%
Create Realm 270.7±2.94ns 227.5±4.04ns -15.96%
Dynamic Object Property Access (Compiler) 1313.2±26.92ns 1309.5±23.20ns -0.28%
Dynamic Object Property Access (Execution) 5.8±0.12µs 5.9±0.07µs +1.72%
Dynamic Object Property Access (Parser) 9.0±0.14µs 8.9±0.14µs -1.11%
Fibonacci (Compiler) 1896.1±32.73ns 1895.0±33.66ns -0.06%
Fibonacci (Execution) 1541.4±27.93µs 1560.0±13.07µs +1.21%
Fibonacci (Parser) 13.7±0.21µs 13.5±0.22µs -1.46%
For loop (Compiler) 1572.1±21.49ns 1584.6±28.76ns +0.80%
For loop (Execution) 36.3±0.64µs 37.4±0.09µs +3.03%
For loop (Parser) 13.6±0.02µs 11.6±0.16µs -14.71%
Mini js (Compiler) 2.7±0.04µs 2.8±0.02µs +3.70%
Mini js (Execution) 878.4±4.29µs 883.3±4.37µs +0.56%
Mini js (Parser) 21.2±0.28µs 21.4±0.37µs +0.94%
Number Object Access (Compiler) 830.2±11.88ns 875.2±9.25ns +5.42%
Number Object Access (Execution) 3.9±0.04µs 3.8±0.05µs -2.56%
Number Object Access (Parser) 9.4±0.15µs 11.0±0.01µs +17.02%
Object Creation (Compiler) 1122.8±20.15ns 1124.7±20.95ns +0.17%
Object Creation (Execution) 5.2±0.08µs 5.3±0.05µs +1.92%
Object Creation (Parser) 7.7±0.13µs 7.8±0.12µs +1.30%
RegExp (Compiler) 1317.9±21.69ns 1350.4±25.80ns +2.47%
RegExp (Execution) 10.7±0.03µs 10.5±0.09µs -1.87%
RegExp (Parser) 8.4±0.12µs 8.4±0.13µs 0.00%
RegExp Creation (Compiler) 1126.2±17.15ns 1107.8±15.52ns -1.63%
RegExp Creation (Execution) 7.9±0.02µs 7.7±0.13µs -2.53%
RegExp Creation (Parser) 7.1±0.11µs 7.1±0.12µs 0.00%
RegExp Literal (Compiler) 1334.3±18.28ns 1331.9±31.02ns -0.18%
RegExp Literal (Execution) 10.7±0.04µs 10.5±0.08µs -1.87%
RegExp Literal (Parser) 6.7±0.09µs 6.8±0.12µs +1.49%
RegExp Literal Creation (Compiler) 1113.3±15.79ns 1129.6±21.13ns +1.46%
RegExp Literal Creation (Execution) 7.9±0.02µs 7.8±0.09µs -1.27%
RegExp Literal Creation (Parser) 5.3±0.08µs 5.4±0.10µs +1.89%
Static Object Property Access (Compiler) 1161.5±10.49ns 1139.0±17.41ns -1.94%
Static Object Property Access (Execution) 5.5±0.10µs 5.6±0.04µs +1.82%
Static Object Property Access (Parser) 8.2±0.11µs 8.3±0.13µs +1.22%
String Object Access (Compiler) 1177.0±20.29ns 1226.2±13.98ns +4.18%
String Object Access (Execution) 6.7±0.08µs 6.3±0.08µs -5.97%
String Object Access (Parser) 11.9±0.25µs 11.8±0.20µs -0.84%
String comparison (Compiler) 1735.4±27.18ns 1778.1±15.67ns +2.46%
String comparison (Execution) 5.1±0.02µs 5.1±0.06µs 0.00%
String comparison (Parser) 9.2±0.13µs 9.2±0.22µs 0.00%
String concatenation (Compiler) 1328.1±19.91ns 1321.1±21.71ns -0.53%
String concatenation (Execution) 4.7±0.02µs 4.6±0.03µs -2.13%
String concatenation (Parser) 6.3±0.10µs 6.3±0.09µs 0.00%
String copy (Compiler) 1057.1±17.73ns 1053.4±16.61ns -0.35%
String copy (Execution) 4.2±0.01µs 4.1±0.07µs -2.38%
String copy (Parser) 4.7±0.08µs 4.7±0.08µs 0.00%
Symbols (Compiler) 706.2±11.17ns 833.7±1.40ns +18.05%
Symbols (Execution) 4.0±0.06µs 4.0±0.01µs 0.00%
Symbols (Parser) 4.3±0.00µs 3.6±0.06µs -16.28%

@github-actions
Copy link

Benchmark for 8eff2bc

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 481.4±0.82ns 465.0±1.20ns -3.41%
Arithmetic operations (Execution) 2.0±0.00µs 2.0±0.00µs 0.00%
Arithmetic operations (Parser) 5.6±0.00µs 5.6±0.01µs 0.00%
Array access (Compiler) 1176.0±2.33ns 1196.5±25.64ns +1.74%
Array access (Execution) 10.3±0.05µs 10.1±0.04µs -1.94%
Array access (Parser) 12.2±0.01µs 11.8±0.01µs -3.28%
Array creation (Compiler) 1716.9±5.99ns 1742.7±3.52ns +1.50%
Array creation (Execution) 3.0±0.00ms 3.1±0.01ms +3.33%
Array creation (Parser) 13.6±0.02µs 13.2±0.04µs -2.94%
Array pop (Compiler) 3.4±0.01µs 3.4±0.02µs 0.00%
Array pop (Execution) 1319.8±9.08µs 1333.1±3.82µs +1.01%
Array pop (Parser) 142.5±0.11µs 136.3±0.10µs -4.35%
Boolean Object Access (Compiler) 1031.7±8.64ns 1032.5±47.40ns +0.08%
Boolean Object Access (Execution) 5.6±0.01µs 5.6±0.01µs 0.00%
Boolean Object Access (Parser) 14.5±0.03µs 14.1±0.02µs -2.76%
Clean js (Compiler) 3.2±0.01µs 3.2±0.03µs 0.00%
Clean js (Execution) 1078.2±8.95µs 1076.1±6.65µs -0.19%
Clean js (Parser) 29.5±0.05µs 28.8±0.04µs -2.37%
Create Realm 270.3±0.19ns 269.7±0.36ns -0.22%
Dynamic Object Property Access (Compiler) 1552.1±2.66ns 1499.4±8.91ns -3.40%
Dynamic Object Property Access (Execution) 6.7±0.03µs 6.6±0.03µs -1.49%
Dynamic Object Property Access (Parser) 10.8±0.03µs 10.5±0.02µs -2.78%
Fibonacci (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 1785.0±2.90µs 1746.2±6.27µs -2.17%
Fibonacci (Parser) 16.5±0.02µs 16.0±0.03µs -3.03%
For loop (Compiler) 1845.7±3.23ns 1829.4±5.24ns -0.88%
For loop (Execution) 42.2±0.16µs 42.3±0.16µs +0.24%
For loop (Parser) 14.2±0.03µs 13.8±0.02µs -2.82%
Mini js (Compiler) 3.2±0.01µs 3.1±0.01µs -3.13%
Mini js (Execution) 997.8±5.87µs 995.1±6.18µs -0.27%
Mini js (Parser) 25.7±0.03µs 25.1±0.04µs -2.33%
Number Object Access (Compiler) 987.9±14.68ns 975.1±1.15ns -1.30%
Number Object Access (Execution) 4.4±0.02µs 4.3±0.01µs -2.27%
Number Object Access (Parser) 11.5±0.02µs 11.1±0.01µs -3.48%
Object Creation (Compiler) 1286.2±2.35ns 1302.7±1.97ns +1.28%
Object Creation (Execution) 6.1±0.01µs 5.9±0.02µs -3.28%
Object Creation (Parser) 9.5±0.03µs 9.1±0.02µs -4.21%
RegExp (Compiler) 1533.6±3.84ns 1556.0±19.25ns +1.46%
RegExp (Execution) 12.1±0.07µs 11.8±0.05µs -2.48%
RegExp (Parser) 10.4±0.02µs 10.0±0.01µs -3.85%
RegExp Creation (Compiler) 1324.0±2.17ns 1316.5±3.33ns -0.57%
RegExp Creation (Execution) 9.0±0.04µs 8.8±0.02µs -2.22%
RegExp Creation (Parser) 8.7±0.03µs 8.3±0.03µs -4.60%
RegExp Literal (Compiler) 1563.3±3.40ns 1559.4±20.47ns -0.25%
RegExp Literal (Execution) 12.1±0.06µs 11.9±0.07µs -1.65%
RegExp Literal (Parser) 8.3±0.03µs 8.0±0.01µs -3.61%
RegExp Literal Creation (Compiler) 1301.4±2.36ns 1306.5±2.40ns +0.39%
RegExp Literal Creation (Execution) 9.0±0.03µs 8.8±0.02µs -2.22%
RegExp Literal Creation (Parser) 6.6±0.01µs 6.4±0.01µs -3.03%
Static Object Property Access (Compiler) 1339.1±2.67ns 1298.4±1.87ns -3.04%
Static Object Property Access (Execution) 6.4±0.03µs 6.2±0.02µs -3.13%
Static Object Property Access (Parser) 10.1±0.03µs 9.7±0.02µs -3.96%
String Object Access (Compiler) 1382.4±4.21ns 1373.2±10.46ns -0.67%
String Object Access (Execution) 7.5±0.03µs 7.3±0.07µs -2.67%
String Object Access (Parser) 14.4±0.01µs 13.9±0.03µs -3.47%
String comparison (Compiler) 2.0±0.01µs 1993.7±2.85ns -0.31%
String comparison (Execution) 5.8±0.01µs 5.8±0.01µs 0.00%
String comparison (Parser) 11.2±0.06µs 10.9±0.02µs -2.68%
String concatenation (Compiler) 1558.9±2.23ns 1550.3±2.24ns -0.55%
String concatenation (Execution) 5.2±0.03µs 5.1±0.02µs -1.92%
String concatenation (Parser) 7.8±0.02µs 7.5±0.02µs -3.85%
String copy (Compiler) 1229.0±3.60ns 1208.7±3.62ns -1.65%
String copy (Execution) 4.7±0.01µs 4.7±0.01µs 0.00%
String copy (Parser) 5.8±0.01µs 5.6±0.02µs -3.45%
Symbols (Compiler) 832.4±1.87ns 829.2±1.78ns -0.38%
Symbols (Execution) 4.5±0.01µs 4.5±0.01µs 0.00%
Symbols (Parser) 4.4±0.01µs 4.3±0.01µs -2.27%

@github-actions
Copy link

Benchmark for 55eb70f

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 469.7±1.29ns 463.2±1.46ns -1.38%
Arithmetic operations (Execution) 2.0±0.00µs 2.0±0.00µs 0.00%
Arithmetic operations (Parser) 5.5±0.01µs 5.5±0.01µs 0.00%
Array access (Compiler) 1210.5±12.15ns 1193.4±8.41ns -1.41%
Array access (Execution) 10.2±0.25µs 10.2±0.04µs 0.00%
Array access (Parser) 11.8±0.02µs 11.8±0.01µs 0.00%
Array creation (Compiler) 1742.2±13.16ns 1741.5±4.07ns -0.04%
Array creation (Execution) 3.0±0.00ms 3.1±0.00ms +3.33%
Array creation (Parser) 13.1±0.03µs 13.4±0.02µs +2.29%
Array pop (Compiler) 3.4±0.01µs 3.4±0.02µs 0.00%
Array pop (Execution) 1318.0±3.40µs 1333.8±3.23µs +1.20%
Array pop (Parser) 136.9±0.11µs 136.4±0.15µs -0.37%
Boolean Object Access (Compiler) 1022.4±2.44ns 1031.2±3.39ns +0.86%
Boolean Object Access (Execution) 5.6±0.01µs 5.6±0.01µs 0.00%
Boolean Object Access (Parser) 13.9±0.02µs 14.2±0.03µs +2.16%
Clean js (Compiler) 3.2±0.01µs 3.2±0.02µs 0.00%
Clean js (Execution) 1084.2±7.35µs 1085.7±4.65µs +0.14%
Clean js (Parser) 28.6±0.03µs 28.7±0.04µs +0.35%
Create Realm 270.4±3.12ns 270.4±0.22ns 0.00%
Dynamic Object Property Access (Compiler) 1529.8±3.23ns 1501.5±3.27ns -1.85%
Dynamic Object Property Access (Execution) 6.7±0.02µs 6.6±0.03µs -1.49%
Dynamic Object Property Access (Parser) 10.4±0.02µs 10.5±0.02µs +0.96%
Fibonacci (Compiler) 2.2±0.00µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 1791.3±2.55µs 1766.5±2.49µs -1.38%
Fibonacci (Parser) 15.7±0.03µs 15.9±0.03µs +1.27%
For loop (Compiler) 1838.1±3.81ns 1803.7±4.15ns -1.87%
For loop (Execution) 42.3±0.14µs 42.2±0.14µs -0.24%
For loop (Parser) 13.7±0.02µs 13.7±0.02µs 0.00%
Mini js (Compiler) 3.1±0.01µs 3.1±0.01µs 0.00%
Mini js (Execution) 994.5±8.37µs 1006.2±36.50µs +1.18%
Mini js (Parser) 25.0±0.03µs 25.0±0.14µs 0.00%
Number Object Access (Compiler) 977.7±1.82ns 975.4±1.57ns -0.24%
Number Object Access (Execution) 4.4±0.01µs 4.4±0.01µs 0.00%
Number Object Access (Parser) 11.1±0.02µs 11.1±0.01µs 0.00%
Object Creation (Compiler) 1294.9±2.76ns 1304.5±2.31ns +0.74%
Object Creation (Execution) 6.0±0.02µs 6.0±0.02µs 0.00%
Object Creation (Parser) 9.0±0.04µs 9.1±0.01µs +1.11%
RegExp (Compiler) 1538.8±2.78ns 1561.2±12.68ns +1.46%
RegExp (Execution) 12.1±0.05µs 12.0±0.06µs -0.83%
RegExp (Parser) 9.8±0.02µs 9.9±0.01µs +1.02%
RegExp Creation (Compiler) 1334.3±2.17ns 1316.7±4.24ns -1.32%
RegExp Creation (Execution) 9.0±0.12µs 8.9±0.02µs -1.11%
RegExp Creation (Parser) 8.3±0.03µs 8.3±0.04µs 0.00%
RegExp Literal (Compiler) 1533.2±3.61ns 1565.1±11.90ns +2.08%
RegExp Literal (Execution) 12.1±0.06µs 12.1±0.06µs 0.00%
RegExp Literal (Parser) 7.9±0.01µs 8.0±0.01µs +1.27%
RegExp Literal Creation (Compiler) 1295.2±2.29ns 1302.4±3.02ns +0.56%
RegExp Literal Creation (Execution) 9.0±0.04µs 8.9±0.03µs -1.11%
RegExp Literal Creation (Parser) 6.3±0.01µs 6.3±0.01µs 0.00%
Static Object Property Access (Compiler) 1327.3±1.91ns 1311.5±57.09ns -1.19%
Static Object Property Access (Execution) 6.3±0.02µs 6.3±0.02µs 0.00%
Static Object Property Access (Parser) 9.6±0.02µs 9.8±0.10µs +2.08%
String Object Access (Compiler) 1383.9±5.03ns 1421.4±12.26ns +2.71%
String Object Access (Execution) 7.4±0.03µs 7.4±0.02µs 0.00%
String Object Access (Parser) 13.8±0.03µs 13.9±0.01µs +0.72%
String comparison (Compiler) 2.0±0.00µs 2.0±0.00µs 0.00%
String comparison (Execution) 5.8±0.01µs 5.8±0.01µs 0.00%
String comparison (Parser) 10.8±0.02µs 10.8±0.04µs 0.00%
String concatenation (Compiler) 1588.7±2.35ns 1548.1±3.51ns -2.56%
String concatenation (Execution) 5.3±0.01µs 5.2±0.02µs -1.89%
String concatenation (Parser) 7.4±0.07µs 7.5±0.01µs +1.35%
String copy (Compiler) 1200.9±2.59ns 1231.8±3.45ns +2.57%
String copy (Execution) 4.7±0.01µs 4.7±0.01µs 0.00%
String copy (Parser) 5.6±0.01µs 5.5±0.01µs -1.79%
Symbols (Compiler) 828.0±1.77ns 844.1±1.80ns +1.94%
Symbols (Execution) 4.5±0.01µs 4.5±0.04µs 0.00%
Symbols (Parser) 4.3±0.00µs 4.2±0.00µs -2.33%

@github-actions
Copy link

Benchmark for 6be7440

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 461.7±0.83ns 474.6±1.68ns +2.79%
Arithmetic operations (Execution) 2.0±0.00µs 2.0±0.00µs 0.00%
Arithmetic operations (Parser) 5.5±0.00µs 5.5±0.01µs 0.00%
Array access (Compiler) 1211.2±5.31ns 1245.0±6.73ns +2.79%
Array access (Execution) 10.2±0.05µs 10.1±0.05µs -0.98%
Array access (Parser) 11.8±0.02µs 11.8±0.11µs 0.00%
Array creation (Compiler) 1712.8±4.25ns 1750.3±9.46ns +2.19%
Array creation (Execution) 3.0±0.00ms 3.1±0.00ms +3.33%
Array creation (Parser) 13.3±0.02µs 13.2±0.03µs -0.75%
Array pop (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Array pop (Execution) 1314.8±6.55µs 1334.0±22.03µs +1.46%
Array pop (Parser) 137.0±0.11µs 136.2±0.19µs -0.58%
Boolean Object Access (Compiler) 1027.4±17.17ns 1030.7±1.92ns +0.32%
Boolean Object Access (Execution) 5.7±0.01µs 5.6±0.03µs -1.75%
Boolean Object Access (Parser) 14.0±0.02µs 14.1±0.02µs +0.71%
Clean js (Compiler) 3.3±0.01µs 3.2±0.01µs -3.03%
Clean js (Execution) 1083.4±8.74µs 1070.8±6.42µs -1.16%
Clean js (Parser) 28.5±0.02µs 28.6±0.03µs +0.35%
Create Realm 271.0±2.34ns 275.7±0.42ns +1.73%
Dynamic Object Property Access (Compiler) 1506.9±4.23ns 1563.2±8.52ns +3.74%
Dynamic Object Property Access (Execution) 6.7±0.03µs 6.6±0.03µs -1.49%
Dynamic Object Property Access (Parser) 10.5±0.01µs 10.5±0.02µs 0.00%
Fibonacci (Compiler) 2.2±0.01µs 2.3±0.01µs +4.55%
Fibonacci (Execution) 1801.1±3.15µs 1754.5±2.92µs -2.59%
Fibonacci (Parser) 15.8±0.02µs 15.8±0.02µs 0.00%
For loop (Compiler) 1837.9±2.88ns 1913.2±4.70ns +4.10%
For loop (Execution) 42.0±0.15µs 42.2±0.17µs +0.48%
For loop (Parser) 13.7±0.02µs 13.7±0.02µs 0.00%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 1007.0±5.81µs 990.3±8.68µs -1.66%
Mini js (Parser) 25.1±0.03µs 25.1±0.02µs 0.00%
Number Object Access (Compiler) 978.6±1.53ns 974.1±1.24ns -0.46%
Number Object Access (Execution) 4.5±0.02µs 4.4±0.01µs -2.22%
Number Object Access (Parser) 11.0±0.01µs 11.1±0.01µs +0.91%
Object Creation (Compiler) 1303.7±2.71ns 1351.0±16.78ns +3.63%
Object Creation (Execution) 6.0±0.01µs 6.0±0.01µs 0.00%
Object Creation (Parser) 9.1±0.02µs 9.1±0.01µs 0.00%
RegExp (Compiler) 1564.7±2.49ns 1542.3±9.22ns -1.43%
RegExp (Execution) 12.2±0.06µs 11.9±0.08µs -2.46%
RegExp (Parser) 9.9±0.03µs 9.9±0.02µs 0.00%
RegExp Creation (Compiler) 1315.9±1.34ns 1334.4±2.58ns +1.41%
RegExp Creation (Execution) 9.0±0.03µs 8.9±0.05µs -1.11%
RegExp Creation (Parser) 8.3±0.02µs 8.3±0.02µs 0.00%
RegExp Literal (Compiler) 1511.6±3.26ns 1561.2±21.06ns +3.28%
RegExp Literal (Execution) 12.1±0.06µs 11.9±0.07µs -1.65%
RegExp Literal (Parser) 8.0±0.01µs 8.0±0.01µs 0.00%
RegExp Literal Creation (Compiler) 1308.5±1.92ns 1317.5±2.76ns +0.69%
RegExp Literal Creation (Execution) 9.0±0.03µs 8.8±0.02µs -2.22%
RegExp Literal Creation (Parser) 6.2±0.01µs 6.3±0.02µs +1.61%
Static Object Property Access (Compiler) 1310.2±1.93ns 1371.1±4.45ns +4.65%
Static Object Property Access (Execution) 6.3±0.03µs 6.2±0.02µs -1.59%
Static Object Property Access (Parser) 9.7±0.02µs 9.7±0.01µs 0.00%
String Object Access (Compiler) 1381.7±4.36ns 1387.0±14.67ns +0.38%
String Object Access (Execution) 7.5±0.03µs 7.3±0.03µs -2.67%
String Object Access (Parser) 13.8±0.01µs 13.9±0.04µs +0.72%
String comparison (Compiler) 2.0±0.00µs 2.0±0.00µs 0.00%
String comparison (Execution) 5.8±0.01µs 5.8±0.01µs 0.00%
String comparison (Parser) 10.8±0.02µs 10.8±0.01µs 0.00%
String concatenation (Compiler) 1571.8±18.70ns 1559.9±2.83ns -0.76%
String concatenation (Execution) 5.2±0.02µs 5.1±0.01µs -1.92%
String concatenation (Parser) 7.4±0.04µs 7.4±0.01µs 0.00%
String copy (Compiler) 1212.5±4.27ns 1230.2±3.50ns +1.46%
String copy (Execution) 4.7±0.01µs 4.6±0.01µs -2.13%
String copy (Parser) 5.5±0.02µs 5.5±0.02µs 0.00%
Symbols (Compiler) 849.6±2.43ns 842.8±3.52ns -0.80%
Symbols (Execution) 4.5±0.01µs 4.4±0.02µs -2.22%
Symbols (Parser) 4.2±0.01µs 4.2±0.00µs 0.00%

@github-actions
Copy link

Benchmark for d0593f4

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 385.4±4.64ns 437.8±0.81ns +13.60%
Arithmetic operations (Execution) 1756.6±5.27ns 2.0±0.00µs +13.86%
Arithmetic operations (Parser) 4.9±0.00µs 5.5±0.01µs +12.24%
Array access (Compiler) 1211.4±3.29ns 1217.9±5.05ns +0.54%
Array access (Execution) 9.0±0.05µs 10.3±0.05µs +14.44%
Array access (Parser) 12.0±0.02µs 11.8±0.02µs -1.67%
Array creation (Compiler) 1719.8±6.29ns 1771.3±4.58ns +2.99%
Array creation (Execution) 3.1±0.00ms 2.8±0.01ms -9.68%
Array creation (Parser) 13.3±0.03µs 13.3±0.02µs 0.00%
Array pop (Compiler) 3.3±0.01µs 3.7±0.01µs +12.12%
Array pop (Execution) 1340.7±27.43µs 1212.7±8.77µs -9.55%
Array pop (Parser) 138.3±0.24µs 136.5±0.14µs -1.30%
Boolean Object Access (Compiler) 1044.9±2.24ns 1031.0±2.22ns -1.33%
Boolean Object Access (Execution) 4.9±0.02µs 5.8±0.02µs +18.37%
Boolean Object Access (Parser) 14.0±0.05µs 14.1±0.02µs +0.71%
Clean js (Compiler) 2.8±0.01µs 3.2±0.01µs +14.29%
Clean js (Execution) 951.8±4.59µs 1121.3±6.17µs +17.81%
Clean js (Parser) 25.1±0.04µs 28.6±0.12µs +13.94%
Create Realm 233.2±2.32ns 266.8±1.31ns +14.41%
Dynamic Object Property Access (Compiler) 1558.9±3.21ns 1554.1±2.53ns -0.31%
Dynamic Object Property Access (Execution) 5.9±0.02µs 6.8±0.04µs +15.25%
Dynamic Object Property Access (Parser) 9.3±0.02µs 10.6±0.02µs +13.98%
Fibonacci (Compiler) 1908.0±7.68ns 2.2±0.01µs +15.30%
Fibonacci (Execution) 1549.8±3.43µs 1787.2±3.21µs +15.32%
Fibonacci (Parser) 14.1±0.02µs 16.1±0.01µs +14.18%
For loop (Compiler) 1611.1±5.54ns 1882.8±4.65ns +16.86%
For loop (Execution) 42.7±0.12µs 42.2±0.29µs -1.17%
For loop (Parser) 12.2±0.02µs 13.7±0.02µs +12.30%
Mini js (Compiler) 2.7±0.02µs 3.2±0.01µs +18.52%
Mini js (Execution) 875.6±3.79µs 1032.9±7.63µs +17.96%
Mini js (Parser) 22.0±0.07µs 25.1±0.18µs +14.09%
Number Object Access (Compiler) 965.6±1.66ns 973.2±1.72ns +0.79%
Number Object Access (Execution) 3.9±0.01µs 4.6±0.02µs +17.95%
Number Object Access (Parser) 11.0±0.02µs 11.0±0.04µs 0.00%
Object Creation (Compiler) 1147.2±2.72ns 1315.7±2.18ns +14.69%
Object Creation (Execution) 5.4±0.01µs 6.1±0.01µs +12.96%
Object Creation (Parser) 8.1±0.05µs 9.2±0.02µs +13.58%
RegExp (Compiler) 1537.4±5.28ns 1556.3±2.57ns +1.23%
RegExp (Execution) 12.0±0.06µs 12.3±0.07µs +2.50%
RegExp (Parser) 10.1±0.05µs 10.1±0.02µs 0.00%
RegExp Creation (Compiler) 1323.4±3.98ns 1356.8±3.27ns +2.52%
RegExp Creation (Execution) 7.9±0.02µs 8.0±0.02µs +1.27%
RegExp Creation (Parser) 7.4±0.02µs 8.4±0.02µs +13.51%
RegExp Literal (Compiler) 1508.3±4.61ns 1566.2±2.47ns +3.84%
RegExp Literal (Execution) 10.5±0.04µs 12.2±0.06µs +16.19%
RegExp Literal (Parser) 7.1±0.01µs 8.1±0.01µs +14.08%
RegExp Literal Creation (Compiler) 1314.8±1.69ns 1369.6±4.59ns +4.17%
RegExp Literal Creation (Execution) 9.0±0.03µs 8.9±0.38µs -1.11%
RegExp Literal Creation (Parser) 5.6±0.03µs 6.4±0.01µs +14.29%
Static Object Property Access (Compiler) 1326.7±1.91ns 1345.1±3.28ns +1.39%
Static Object Property Access (Execution) 6.3±0.02µs 6.4±0.02µs +1.59%
Static Object Property Access (Parser) 8.8±0.04µs 9.9±0.01µs +12.50%
String Object Access (Compiler) 1366.9±3.78ns 1382.4±8.64ns +1.13%
String Object Access (Execution) 6.6±0.04µs 7.7±0.02µs +16.67%
String Object Access (Parser) 13.8±0.02µs 13.9±0.01µs +0.72%
String comparison (Compiler) 1993.1±2.47ns 2.1±0.01µs +5.36%
String comparison (Execution) 5.8±0.02µs 5.9±0.01µs +1.72%
String comparison (Parser) 10.8±0.03µs 9.7±0.02µs -10.19%
String concatenation (Compiler) 1556.8±2.84ns 1603.2±5.37ns +2.98%
String concatenation (Execution) 5.3±0.02µs 5.3±0.02µs 0.00%
String concatenation (Parser) 7.5±0.01µs 7.6±0.02µs +1.33%
String copy (Compiler) 1225.8±3.11ns 1272.6±2.96ns +3.82%
String copy (Execution) 4.8±0.02µs 4.7±0.01µs -2.08%
String copy (Parser) 5.6±0.02µs 4.9±0.03µs -12.50%
Symbols (Compiler) 748.2±2.30ns 844.6±2.18ns +12.88%
Symbols (Execution) 3.9±0.02µs 4.6±0.01µs +17.95%
Symbols (Parser) 3.8±0.01µs 3.8±0.02µs 0.00%

@RageKnify
Copy link
Contributor

bors r+

@bors
Copy link

bors bot commented Feb 22, 2022

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

bors bot pushed a commit that referenced this pull request Feb 22, 2022
This Pull Request closes #1693.

It changes the following:

- It adds a fallible conversion from `serde_json::Value` to `JsValue`, which requires a context.
- It adds a fallible conversion from `JsValue` to `serde_json::Value`, which requires a context.
- Added examples to the documentation of both methods.
- Removed some duplicate and non-needed code that I found while doing this.


Co-authored-by: RageKnify <RageKnify@gmail.com>
@bors
Copy link

bors bot commented Feb 22, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Added conversions from and to serde_json's Value type [Merged by Bors] - Added conversions from and to serde_json's Value type Feb 22, 2022
@bors bors bot closed this Feb 22, 2022
@bors bors bot deleted the json branch February 22, 2022 16:22
@github-actions
Copy link

Benchmark for ab9d80d

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 430.6±1.30ns 435.3±1.23ns +1.09%
Arithmetic operations (Execution) 1902.1±3.37ns 1880.6±2.45ns -1.13%
Arithmetic operations (Parser) 5.7±0.01µs 5.7±0.07µs 0.00%
Array access (Compiler) 1254.0±2.10ns 1283.5±3.14ns +2.35%
Array access (Execution) 10.7±0.07µs 10.4±0.05µs -2.80%
Array access (Parser) 12.6±0.07µs 13.0±0.06µs +3.17%
Array creation (Compiler) 1871.1±3.40ns 1898.5±4.21ns +1.46%
Array creation (Execution) 3.1±0.00ms 3.1±0.06ms 0.00%
Array creation (Parser) 14.1±0.05µs 14.3±0.03µs +1.42%
Array pop (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Array pop (Execution) 1348.0±5.88µs 1336.4±3.59µs -0.86%
Array pop (Parser) 144.7±0.19µs 143.7±0.17µs -0.69%
Boolean Object Access (Compiler) 1055.6±2.18ns 1056.2±2.93ns +0.06%
Boolean Object Access (Execution) 5.7±0.03µs 5.6±0.01µs -1.75%
Boolean Object Access (Parser) 14.3±0.02µs 15.0±0.02µs +4.90%
Clean js (Compiler) 3.6±0.01µs 3.6±0.01µs 0.00%
Clean js (Execution) 1072.4±7.56µs 1051.6±8.11µs -1.94%
Clean js (Parser) 29.9±0.08µs 30.3±0.07µs +1.34%
Create Realm 254.8±2.82ns 251.6±3.07ns -1.26%
Dynamic Object Property Access (Compiler) 1649.7±4.37ns 1691.8±6.99ns +2.55%
Dynamic Object Property Access (Execution) 6.7±0.06µs 6.4±0.04µs -4.48%
Dynamic Object Property Access (Parser) 11.3±0.29µs 11.5±0.04µs +1.77%
Fibonacci (Compiler) 2.3±0.01µs 2.4±0.00µs +4.35%
Fibonacci (Execution) 1783.3±6.11µs 1768.7±36.71µs -0.82%
Fibonacci (Parser) 16.7±0.18µs 17.4±0.11µs +4.19%
For loop (Compiler) 2.0±0.01µs 2.0±0.00µs 0.00%
For loop (Execution) 41.6±0.16µs 39.2±0.12µs -5.77%
For loop (Parser) 14.7±0.04µs 14.7±0.04µs 0.00%
Mini js (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Mini js (Execution) 985.3±4.31µs 974.8±16.29µs -1.07%
Mini js (Parser) 26.3±0.15µs 26.4±0.11µs +0.38%
Number Object Access (Compiler) 973.9±2.87ns 1002.8±3.48ns +2.97%
Number Object Access (Execution) 4.4±0.01µs 4.3±0.01µs -2.27%
Number Object Access (Parser) 11.2±0.09µs 11.5±0.07µs +2.68%
Object Creation (Compiler) 1400.9±4.79ns 1430.9±7.39ns +2.14%
Object Creation (Execution) 5.9±0.02µs 5.9±0.03µs 0.00%
Object Creation (Parser) 9.9±0.04µs 10.1±0.04µs +2.02%
RegExp (Compiler) 1619.0±3.81ns 1635.1±5.13ns +0.99%
RegExp (Execution) 12.2±0.05µs 12.3±0.06µs +0.82%
RegExp (Parser) 10.6±0.06µs 10.8±0.07µs +1.89%
RegExp Creation (Compiler) 1384.6±3.19ns 1391.7±2.93ns +0.51%
RegExp Creation (Execution) 9.1±0.03µs 9.2±0.04µs +1.10%
RegExp Creation (Parser) 8.7±0.05µs 9.1±0.06µs +4.60%
RegExp Literal (Compiler) 1610.9±3.64ns 1605.5±5.35ns -0.34%
RegExp Literal (Execution) 12.3±0.05µs 12.3±0.08µs 0.00%
RegExp Literal (Parser) 8.6±0.08µs 8.8±0.08µs +2.33%
RegExp Literal Creation (Compiler) 1409.1±26.05ns 1381.5±2.64ns -1.96%
RegExp Literal Creation (Execution) 9.1±0.03µs 9.3±0.03µs +2.20%
RegExp Literal Creation (Parser) 6.9±0.04µs 7.1±0.03µs +2.90%
Static Object Property Access (Compiler) 1401.8±3.62ns 1473.9±9.30ns +5.14%
Static Object Property Access (Execution) 6.4±0.04µs 6.1±0.02µs -4.69%
Static Object Property Access (Parser) 10.6±0.04µs 10.8±0.03µs +1.89%
String Object Access (Compiler) 1444.1±7.99ns 1454.8±20.61ns +0.74%
String Object Access (Execution) 7.7±0.04µs 7.4±0.01µs -3.90%
String Object Access (Parser) 14.1±0.07µs 14.5±0.02µs +2.84%
String comparison (Compiler) 2.2±0.01µs 2.1±0.01µs -4.55%
String comparison (Execution) 5.9±0.03µs 5.9±0.01µs 0.00%
String comparison (Parser) 11.4±0.04µs 11.4±0.06µs 0.00%
String concatenation (Compiler) 1613.5±4.05ns 1629.5±4.21ns +0.99%
String concatenation (Execution) 5.4±0.06µs 5.3±0.08µs -1.85%
String concatenation (Parser) 7.9±0.07µs 8.0±0.06µs +1.27%
String copy (Compiler) 1302.0±2.63ns 1288.1±3.33ns -1.07%
String copy (Execution) 4.7±0.01µs 4.8±0.01µs +2.13%
String copy (Parser) 6.0±0.04µs 6.0±0.09µs 0.00%
Symbols (Compiler) 853.7±6.55ns 872.5±1.83ns +2.20%
Symbols (Execution) 4.5±0.01µs 4.4±0.07µs -2.22%
Symbols (Parser) 4.5±0.07µs 4.6±0.08µs +2.22%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Easy conversion from JsValue to serde_json::Value
3 participants