Skip to content

Commit

Permalink
Merge branch 'main' into issue729-toLocaleString-withArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisMerinoP committed Nov 19, 2023
2 parents 8128ba2 + 4b4d64f commit 04e9c99
Show file tree
Hide file tree
Showing 213 changed files with 4,535 additions and 1,870 deletions.
42 changes: 42 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,48 @@ indent_size = 2
# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = warning

# Error CA1051 : Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = none

# Error CA1720 : Identifiers should not contain type names
dotnet_diagnostic.CA1720.severity = none

# Error CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = none

# Error CA1710: Identifiers should have correct suffix
dotnet_diagnostic.CA1710.severity = none

# Error CA1716: Identifiers should have correct suffix
dotnet_diagnostic.CA1716.severity = none

# Error MA0026: TODO
dotnet_diagnostic.MA0026.severity = none

# Error MA0048 : File name must match type name
dotnet_diagnostic.MA0048.severity = none

# Error MA0016 : Prefer using collection abstraction instead of implementation
dotnet_diagnostic.MA0016.severity = none

# Error MA0017 : Abstract types should not have public or internal constructors
dotnet_diagnostic.MA0017.severity = none

# Error MA0051 : Method is too long
dotnet_diagnostic.MA0051.severity = none

# Error MA0046 : The delegate must return void
dotnet_diagnostic.MA0046.severity = none

# Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators
dotnet_diagnostic.MA0097.severity = none

# Error MA0025 : Implement the functionality (or raise NotSupportedException or PlatformNotSupportedException)
dotnet_diagnostic.MA0025.severity = none

# Error MA0091 : Sender parameter should be 'this' for instance events
dotnet_diagnostic.MA0091.severity = none

# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
Expand Down
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>

</Project>
33 changes: 33 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.10" />
<PackageVersion Include="Esprima" Version="3.0.2" />
<PackageVersion Include="Flurl.Http.Signed" Version="3.2.4" />
<PackageVersion Include="Jurassic" Version="3.2.7" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.106" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="MongoDB.Bson.signed" Version="2.19.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NiL.JS" Version="2.5.1674" />
<PackageVersion Include="NodaTime" Version="3.1.9" />
<PackageVersion Include="NUnit" Version="3.14.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.0" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.45.0" />
<PackageVersion Include="System.Text.Json" Version="6.0.8" />
<PackageVersion Include="Test262Harness" Version="0.0.22" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="YantraJS.Core" Version="1.2.203" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="PolySharp" Version="1.13.2" />
</ItemGroup>
</Project>
7 changes: 6 additions & 1 deletion Jint.Benchmark/EngineComparisonBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Order;
using Esprima;
using Esprima.Ast;

namespace Jint.Benchmark;

[RankColumn]
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByParams)]
[HideColumns("Error", "Gen0", "Gen1", "Gen2")]
[BenchmarkCategory("EngineComparison")]
Expand Down Expand Up @@ -91,6 +93,9 @@ public void NilJS()
public void YantraJS()
{
var engine = new YantraJS.Core.JSContext();
engine.Eval(_files[FileName]);
// By default YantraJS is strict mode only, in strict mode
// we need to pass `this` explicitly in global context
// if script is expecting global context as `this`
engine.Eval(_files[FileName], null, engine);
}
}
22 changes: 17 additions & 5 deletions Jint.Benchmark/EngineConstructionBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
using BenchmarkDotNet.Attributes;
using Esprima;
using Esprima.Ast;
using Jint.Native;

namespace Jint.Benchmark;

[MemoryDiagnoser]
public class EngineConstructionBenchmark
{
private readonly Script _program;
private Script _program;
private Script _simple;

public EngineConstructionBenchmark()
[GlobalSetup]
public void GlobalSetup()
{
var parser = new JavaScriptParser();
_program = parser.ParseScript("return [].length + ''.length");
_program = parser.ParseScript("([].length + ''.length)");
_simple = parser.ParseScript("1");
new Engine().Evaluate(_program);
}

[Benchmark]
public double BuildEngine()
public Engine BuildEngine()
{
var engine = new Engine();
return engine.Evaluate(_program).AsNumber();
return engine;
}

[Benchmark]
public JsValue EvaluateSimple()
{
var engine = new Engine();
return engine.Evaluate(_simple);
}
}
12 changes: 6 additions & 6 deletions Jint.Benchmark/Jint.Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
Expand All @@ -24,10 +24,10 @@
<ProjectReference Include="..\Jint\Jint.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Jurassic" Version="3.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NiL.JS" Version="2.5.1650" />
<PackageReference Include="YantraJS.Core" Version="1.2.117" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="Jurassic" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NiL.JS" />
<PackageReference Include="YantraJS.Core" />
</ItemGroup>
</Project>
Loading

0 comments on commit 04e9c99

Please sign in to comment.