diff --git a/Jint.Benchmark/EngineComparisonBenchmark.cs b/Jint.Benchmark/EngineComparisonBenchmark.cs index ecaf7d2aa6..2277284711 100644 --- a/Jint.Benchmark/EngineComparisonBenchmark.cs +++ b/Jint.Benchmark/EngineComparisonBenchmark.cs @@ -1,5 +1,6 @@ using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Order; using Esprima; using Esprima.Ast; @@ -7,6 +8,7 @@ namespace Jint.Benchmark; [RankColumn] [MemoryDiagnoser] +[Orderer(SummaryOrderPolicy.FastestToSlowest)] [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByParams)] [HideColumns("Error", "Gen0", "Gen1", "Gen2")] [BenchmarkCategory("EngineComparison")] diff --git a/Jint.Benchmark/Jint.Benchmark.csproj b/Jint.Benchmark/Jint.Benchmark.csproj index a29e3894d7..fa88bf720e 100644 --- a/Jint.Benchmark/Jint.Benchmark.csproj +++ b/Jint.Benchmark/Jint.Benchmark.csproj @@ -24,10 +24,10 @@ - + - - + + \ No newline at end of file diff --git a/Jint.Benchmark/README.md b/Jint.Benchmark/README.md index a2867e9a37..9bacc72f8a 100644 --- a/Jint.Benchmark/README.md +++ b/Jint.Benchmark/README.md @@ -9,91 +9,91 @@ dotnet run -c Release --allCategories EngineComparison * tests are run in global engine strict mode, as YantraJS always uses strict mode which improves performance * `Jint` and `Jint_ParsedScript` shows the difference between always parsing the script source file and reusing parsed `Script` instance. -Last updated 2023-03-26 +Last updated 2023-08-29 * Jint main * Jurassic 3.2.6 -* NiL.JS 2.5.1650 -* YantraJS.Core 1.2.117 +* NiL.JS 2.5.1665 +* YantraJS.Core 1.2.179 +``` -``` ini - -BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1483/22H2/2022Update/SunValley2) +BenchmarkDotNet v0.13.7, Windows 11 (10.0.23531.1001) AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores -.NET SDK=7.0.202 - [Host] : .NET 6.0.15 (6.0.1523.11507), X64 RyuJIT AVX2 - DefaultJob : .NET 6.0.15 (6.0.1523.11507), X64 RyuJIT AVX2 +.NET SDK 8.0.100-preview.7.23376.3 + [Host] : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 + DefaultJob : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 ``` -| Method | FileName | Mean | StdDev | Rank | Allocated | -|------------------ |--------------------- |-----------------:|---------------:|-----:|--------------:| -| **Jint** | **array-stress** | **10,799.249 μs** | **24.4948 μs** | **4** | **7473326 B** | -| Jint_ParsedScript | array-stress | 10,568.342 μs | 44.6133 μs | 3 | 7446494 B | -| Jurassic | array-stress | 11,280.104 μs | 27.9486 μs | 5 | 11926463 B | -| NilJS | array-stress | 5,600.761 μs | 74.2339 μs | 2 | 4241527 B | -| YantraJS | array-stress | 4,891.973 μs | 18.8130 μs | 1 | 6518316 B | -| | | | | | | -| **Jint** | **dromaeo-3d-cube** | **25,234.322 μs** | **28.3103 μs** | **4** | **6307004 B** | -| Jint_ParsedScript | dromaeo-3d-cube | 24,227.022 μs | 30.4230 μs | 3 | 6000208 B | -| Jurassic | dromaeo-3d-cube | 40,155.874 μs | 83.9446 μs | 5 | 10925739 B | -| NilJS | dromaeo-3d-cube | 9,203.608 μs | 18.2137 μs | 2 | 4671638 B | -| YantraJS | dromaeo-3d-cube | 4,478.599 μs | 35.6857 μs | 1 | 8885293 B | -| | | | | | | -| **Jint** | **dromaeo-core-eval** | **5,496.472 μs** | **20.8861 μs** | **2** | **359439 B** | -| Jint_ParsedScript | dromaeo-core-eval | 5,555.814 μs | 29.8913 μs | 2 | 339647 B | -| Jurassic | dromaeo-core-eval | 13,739.640 μs | 52.5257 μs | 4 | 2971062 B | -| NilJS | dromaeo-core-eval | 2,099.576 μs | 13.3939 μs | 1 | 1637011 B | -| YantraJS | dromaeo-core-eval | 8,068.664 μs | 41.8267 μs | 3 | 37131162 B | -| | | | | | | -| **Jint** | **dromaeo-object-array** | **68,157.350 μs** | **106.5991 μs** | **4** | **103974805 B** | -| Jint_ParsedScript | dromaeo-object-array | 70,379.819 μs | 412.9971 μs | 5 | 103928047 B | -| Jurassic | dromaeo-object-array | 41,917.036 μs | 147.6689 μs | 1 | 26433545 B | -| NilJS | dromaeo-object-array | 50,941.149 μs | 116.1891 μs | 3 | 16518497 B | -| YantraJS | dromaeo-object-array | 43,952.908 μs | 52.7966 μs | 2 | 25538081 B | -| | | | | | | -| **Jint** | **droma(...)egexp [21]** | **202,513.639 μs** | **6,280.4683 μs** | **2** | **169538072 B** | -| Jint_ParsedScript | droma(...)egexp [21] | 194,203.576 μs | 2,648.5440 μs | 1 | 176401621 B | -| Jurassic | droma(...)egexp [21] | 673,099.103 μs | 19,449.6381 μs | 4 | 845159056 B | -| NilJS | droma(...)egexp [21] | 498,404.131 μs | 9,389.0173 μs | 3 | 785342384 B | -| YantraJS | droma(...)egexp [21] | 1,021,021.213 μs | 10,171.5386 μs | 5 | 965363992 B | -| | | | | | | -| **Jint** | **droma(...)tring [21]** | **513,139.116 μs** | **21,598.0545 μs** | **2** | **1353627632 B** | -| Jint_ParsedScript | droma(...)tring [21] | 598,346.054 μs | 62,241.8961 μs | 4 | 1353603760 B | -| Jurassic | droma(...)tring [21] | 547,882.282 μs | 15,131.8012 μs | 3 | 1492956848 B | -| NilJS | droma(...)tring [21] | 380,880.402 μs | 17,953.6040 μs | 1 | 1410785672 B | -| YantraJS | droma(...)tring [21] | 3,146,801.586 μs | 75,534.4740 μs | 5 | 16097426568 B | -| | | | | | | -| **Jint** | **droma(...)ase64 [21]** | **54,972.605 μs** | **123.8465 μs** | **3** | **6764151 B** | -| Jint_ParsedScript | droma(...)ase64 [21] | 53,534.261 μs | 272.9451 μs | 2 | 6665682 B | -| Jurassic | droma(...)ase64 [21] | 69,111.283 μs | 166.1184 μs | 4 | 76105181 B | -| NilJS | droma(...)ase64 [21] | 40,131.392 μs | 385.5791 μs | 1 | 20074818 B | -| YantraJS | droma(...)ase64 [21] | 108,860.979 μs | 697.7800 μs | 5 | 778591469 B | -| | | | | | | -| **Jint** | **evaluation** | **28.773 μs** | **0.0494 μs** | **2** | **36792 B** | -| Jint_ParsedScript | evaluation | 11.296 μs | 0.0295 μs | 1 | 27072 B | -| Jurassic | evaluation | 1,291.843 μs | 3.3295 μs | 5 | 430510 B | -| NilJS | evaluation | 45.473 μs | 0.1385 μs | 3 | 24032 B | -| YantraJS | evaluation | 120.995 μs | 0.3959 μs | 4 | 177876 B | -| | | | | | | -| **Jint** | **linq-js** | **1,774.118 μs** | **8.6162 μs** | **2** | **1303058 B** | -| Jint_ParsedScript | linq-js | 90.567 μs | 0.2234 μs | 1 | 213218 B | -| Jurassic | linq-js | 39,199.309 μs | 614.5447 μs | 4 | 9525761 B | -| NilJS | linq-js | 7,630.382 μs | 11.3679 μs | 3 | 4226480 B | -| YantraJS | linq-js | NA | NA | ? | - | -| | | | | | | -| **Jint** | **minimal** | **4.937 μs** | **0.0103 μs** | **3** | **14664 B** | -| Jint_ParsedScript | minimal | 3.124 μs | 0.0123 μs | 1 | 13168 B | -| Jurassic | minimal | 238.384 μs | 0.6775 μs | 5 | 395506 B | -| NilJS | minimal | 4.751 μs | 0.0103 μs | 2 | 4928 B | -| YantraJS | minimal | 117.579 μs | 0.5920 μs | 4 | 173770 B | -| | | | | | | -| **Jint** | **stopwatch** | **368,697.936 μs** | **1,043.7863 μs** | **4** | **52946080 B** | -| Jint_ParsedScript | stopwatch | 408,149.533 μs | 1,052.2644 μs | 5 | 52912288 B | -| Jurassic | stopwatch | 211,731.362 μs | 544.2606 μs | 2 | 160704435 B | -| NilJS | stopwatch | 238,188.624 μs | 480.6546 μs | 3 | 76378157 B | -| YantraJS | stopwatch | 78,043.391 μs | 228.5660 μs | 1 | 264535415 B | +| Method | FileName | Mean | StdDev | Median | Rank | Allocated | +|------------------ |--------------------- |-----------------:|---------------:|-----------------:|-----:|---------------:| +| YantraJS | array-stress | 6,246.687 μs | 28.4141 μs | 6,240.110 μs | 1 | 6533.07 KB | +| NilJS | array-stress | 7,629.064 μs | 21.4722 μs | 7,626.207 μs | 2 | 4533.76 KB | +| Jint | array-stress | 11,304.127 μs | 24.2301 μs | 11,301.966 μs | 3 | 7111.4 KB | +| Jint_ParsedScript | array-stress | 11,928.758 μs | 78.8122 μs | 11,974.534 μs | 4 | 7085.34 KB | +| Jurassic | array-stress | 13,568.895 μs | 49.1134 μs | 13,548.192 μs | 5 | 11646.96 KB | +| | | | | | | | +| YantraJS | dromaeo-3d-cube | NA | NA | NA | ? | NA | +| NilJS | dromaeo-3d-cube | 11,262.315 μs | 39.4986 μs | 11,253.403 μs | 1 | 4694.63 KB | +| Jint_ParsedScript | dromaeo-3d-cube | 26,401.931 μs | 35.0936 μs | 26,404.000 μs | 2 | 5894.78 KB | +| Jint | dromaeo-3d-cube | 27,799.875 μs | 24.2606 μs | 27,802.781 μs | 3 | 6191.02 KB | +| Jurassic | dromaeo-3d-cube | 49,539.274 μs | 137.7463 μs | 49,615.655 μs | 4 | 10671.74 KB | +| | | | | | | | +| NilJS | dromaeo-core-eval | 2,638.637 μs | 8.3816 μs | 2,642.709 μs | 1 | 1598.78 KB | +| Jint | dromaeo-core-eval | 5,986.834 μs | 23.0157 μs | 5,978.144 μs | 2 | 350.31 KB | +| Jint_ParsedScript | dromaeo-core-eval | 6,049.918 μs | 47.3595 μs | 6,052.202 μs | 2 | 331.04 KB | +| YantraJS | dromaeo-core-eval | 15,121.048 μs | 33.6780 μs | 15,127.921 μs | 3 | 36547.42 KB | +| Jurassic | dromaeo-core-eval | 16,809.782 μs | 6.8618 μs | 16,811.078 μs | 4 | 2901.46 KB | +| | | | | | | | +| Jurassic | dromaeo-object-array | 50,652.934 μs | 193.8856 μs | 50,633.500 μs | 1 | 25814.2 KB | +| YantraJS | dromaeo-object-array | 59,426.130 μs | 492.9887 μs | 59,443.689 μs | 2 | 24745.94 KB | +| Jint_ParsedScript | dromaeo-object-array | 66,402.409 μs | 254.3555 μs | 66,323.750 μs | 3 | 100747.98 KB | +| Jint | dromaeo-object-array | 67,909.973 μs | 374.0128 μs | 67,856.262 μs | 4 | 100792.72 KB | +| NilJS | dromaeo-object-array | 76,716.933 μs | 335.0924 μs | 76,717.700 μs | 5 | 17698.13 KB | +| | | | | | | | +| Jint_ParsedScript | droma(...)egexp [21] | 298,212.421 μs | 4,821.1841 μs | 297,469.850 μs | 1 | 165381.18 KB | +| Jint | droma(...)egexp [21] | 308,929.771 μs | 7,106.6296 μs | 307,314.500 μs | 2 | 168713.91 KB | +| NilJS | droma(...)egexp [21] | 603,665.040 μs | 4,970.4874 μs | 605,048.300 μs | 3 | 768274.13 KB | +| Jurassic | droma(...)egexp [21] | 841,737.444 μs | 30,514.3096 μs | 839,741.400 μs | 4 | 825832.59 KB | +| YantraJS | droma(...)egexp [21] | 1,202,044.984 μs | 25,781.0535 μs | 1,198,305.600 μs | 5 | 941580.41 KB | +| | | | | | | | +| NilJS | droma(...)tring [21] | 417,303.358 μs | 13,929.0807 μs | 418,108.100 μs | 1 | 1377743.66 KB | +| Jint_ParsedScript | droma(...)tring [21] | 563,559.551 μs | 33,924.5891 μs | 551,658.750 μs | 2 | 1322031.27 KB | +| Jint | droma(...)tring [21] | 572,808.661 μs | 30,017.2335 μs | 570,151.650 μs | 2 | 1322176.1 KB | +| Jurassic | droma(...)tring [21] | 692,137.075 μs | 28,047.3722 μs | 698,963.900 μs | 3 | 1457949.11 KB | +| YantraJS | droma(...)tring [21] | 4,060,814.093 μs | 60,908.6909 μs | 4,079,384.300 μs | 4 | 15718148.67 KB | +| | | | | | | | +| NilJS | droma(...)ase64 [21] | 47,816.450 μs | 138.7136 μs | 47,770.455 μs | 1 | 19605.27 KB | +| Jint | droma(...)ase64 [21] | 65,790.989 μs | 272.8843 μs | 65,817.512 μs | 2 | 6772.48 KB | +| Jint_ParsedScript | droma(...)ase64 [21] | 66,114.687 μs | 146.3463 μs | 66,118.562 μs | 2 | 6680.29 KB | +| Jurassic | droma(...)ase64 [21] | 84,478.585 μs | 323.0873 μs | 84,454.725 μs | 3 | 74321.7 KB | +| YantraJS | droma(...)ase64 [21] | 235,350.207 μs | 955.7123 μs | 235,605.333 μs | 4 | 760629.53 KB | +| | | | | | | | +| Jint_ParsedScript | evaluation | 13.655 μs | 0.0306 μs | 13.663 μs | 1 | 26.46 KB | +| Jint | evaluation | 34.425 μs | 0.1069 μs | 34.444 μs | 2 | 35.89 KB | +| NilJS | evaluation | 56.276 μs | 0.1443 μs | 56.288 μs | 3 | 23.47 KB | +| YantraJS | evaluation | 129.051 μs | 0.5500 μs | 129.043 μs | 4 | 462.57 KB | +| Jurassic | evaluation | 1,611.643 μs | 2.3082 μs | 1,611.278 μs | 5 | 420.41 KB | +| | | | | | | | +| YantraJS | linq-js | NA | NA | NA | ? | NA | +| Jint_ParsedScript | linq-js | 116.014 μs | 0.6197 μs | 115.770 μs | 1 | 215.13 KB | +| Jint | linq-js | 2,248.864 μs | 6.9181 μs | 2,247.281 μs | 2 | 1274.64 KB | +| NilJS | linq-js | 9,450.914 μs | 26.1239 μs | 9,452.424 μs | 3 | 4127.79 KB | +| Jurassic | linq-js | 46,341.837 μs | 310.1326 μs | 46,370.700 μs | 4 | 9305.52 KB | +| | | | | | | | +| Jint_ParsedScript | minimal | 3.203 μs | 0.0178 μs | 3.196 μs | 1 | 12.9 KB | +| Jint | minimal | 5.230 μs | 0.0169 μs | 5.229 μs | 2 | 14.34 KB | +| NilJS | minimal | 6.055 μs | 0.0276 μs | 6.041 μs | 3 | 4.81 KB | +| YantraJS | minimal | 123.197 μs | 2.7249 μs | 122.828 μs | 4 | 458.56 KB | +| Jurassic | minimal | 297.292 μs | 0.6073 μs | 297.435 μs | 5 | 386.24 KB | +| | | | | | | | +| YantraJS | stopwatch | 112,530.838 μs | 449.4615 μs | 112,460.320 μs | 1 | 258622.36 KB | +| Jurassic | stopwatch | 247,085.684 μs | 1,162.2628 μs | 246,727.867 μs | 2 | 156937.08 KB | +| NilJS | stopwatch | 295,878.240 μs | 2,000.4676 μs | 295,209.200 μs | 3 | 97361.17 KB | +| Jint_ParsedScript | stopwatch | 471,369.071 μs | 1,578.5815 μs | 471,148.200 μs | 4 | 53023.28 KB | +| Jint | stopwatch | 472,028.947 μs | 3,209.3311 μs | 471,611.400 μs | 4 | 53044.52 KB | Benchmarks with issues: -EngineComparisonBenchmark.YantraJS: DefaultJob [FileName=linq-js] \ No newline at end of file +EngineComparisonBenchmark.YantraJS: DefaultJob [FileName=dromaeo-3d-cube] +EngineComparisonBenchmark.YantraJS: DefaultJob [FileName=linq-js] diff --git a/Jint.Tests.CommonScripts/Jint.Tests.CommonScripts.csproj b/Jint.Tests.CommonScripts/Jint.Tests.CommonScripts.csproj index e7a235e631..3032ed81dd 100644 --- a/Jint.Tests.CommonScripts/Jint.Tests.CommonScripts.csproj +++ b/Jint.Tests.CommonScripts/Jint.Tests.CommonScripts.csproj @@ -16,10 +16,10 @@ - - + + - + diff --git a/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj b/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj index 272dd0c4dc..f191524e97 100644 --- a/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj +++ b/Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj @@ -22,13 +22,16 @@ - - + + - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Jint.Tests.Test262/Jint.Tests.Test262.csproj b/Jint.Tests.Test262/Jint.Tests.Test262.csproj index e7e7e5d8ab..0e3f08d1e6 100644 --- a/Jint.Tests.Test262/Jint.Tests.Test262.csproj +++ b/Jint.Tests.Test262/Jint.Tests.Test262.csproj @@ -16,10 +16,10 @@ - - + + - + diff --git a/Jint.Tests/Jint.Tests.csproj b/Jint.Tests/Jint.Tests.csproj index 549f914646..4403b74345 100644 --- a/Jint.Tests/Jint.Tests.csproj +++ b/Jint.Tests/Jint.Tests.csproj @@ -25,13 +25,16 @@ - + - + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Jint/Jint.csproj b/Jint/Jint.csproj index cc591bc37b..fbddda8229 100644 --- a/Jint/Jint.csproj +++ b/Jint/Jint.csproj @@ -19,7 +19,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Jint/Native/Global/GlobalObject.cs b/Jint/Native/Global/GlobalObject.cs index 4496af979b..cd931e2f19 100644 --- a/Jint/Native/Global/GlobalObject.cs +++ b/Jint/Native/Global/GlobalObject.cs @@ -3,13 +3,10 @@ using System.Runtime.CompilerServices; using System.Text; using Esprima; -using Jint.Collections; using Jint.Native.Object; using Jint.Native.String; using Jint.Runtime; using Jint.Runtime.Descriptors; -using Jint.Runtime.Descriptors.Specialized; -using Jint.Runtime.Interop; namespace Jint.Native.Global { diff --git a/Jint/Runtime/Interop/ObjectWrapper.cs b/Jint/Runtime/Interop/ObjectWrapper.cs index 2b76866843..725feaf21a 100644 --- a/Jint/Runtime/Interop/ObjectWrapper.cs +++ b/Jint/Runtime/Interop/ObjectWrapper.cs @@ -1,4 +1,3 @@ -using System; using System.Collections; using System.Globalization; using System.Reflection;