-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepared for building nuget package Changed target frameworks and retrofitted some code features to support bilding for pre-net5.0 targets
- Loading branch information
1 parent
01bdb94
commit 3816243
Showing
11 changed files
with
1,756 additions
and
1,634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="..\..\jsonata-js\test\test-suite\datasets\employees.json" Link="employees.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" /> | ||
<PackageReference Include="Jsonata.Net.Js" Version="1.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Jsonata.Net.Native\Jsonata.Net.Native.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Running; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
namespace BenchmarkApp | ||
{ | ||
public class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
BenchmarkRunner.Run<Program>(); | ||
} | ||
|
||
private readonly string m_data; | ||
private readonly string m_query; | ||
private readonly int m_iterations = 1; | ||
|
||
public Program() | ||
{ | ||
Console.WriteLine(Directory.GetCurrentDirectory()); | ||
this.m_data = File.ReadAllText("employees.json"); | ||
this.m_query = @" | ||
{ | ||
'name': Employee.FirstName & ' ' & Employee.Surname, | ||
'mobile': Contact.Phone[type = 'mobile'].number | ||
} | ||
"; | ||
} | ||
|
||
[Benchmark] | ||
public void ProcessNative() | ||
{ | ||
Jsonata.Net.Native.JsonataQuery evaluator = new Jsonata.Net.Native.JsonataQuery(this.m_query); | ||
JToken json = JToken.Parse(this.m_data); | ||
|
||
for (int i = 0; i < this.m_iterations; ++i) | ||
{ | ||
evaluator.Eval(json); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void ProcessJs() | ||
{ | ||
Jsonata.Net.Js.JsonataEngine engine = new Jsonata.Net.Js.JsonataEngine(); | ||
for (int i = 0; i < this.m_iterations; ++i) | ||
{ | ||
engine.Execute(this.m_query, this.m_data); | ||
} | ||
} | ||
} | ||
} |
3,244 changes: 1,622 additions & 1,622 deletions
3,244
src/Jsonata.Net.Native.TestSuite/TestReport/Jsonata.Net.Native.TestSuite.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#if !NET5_0 | ||
//see https://stackoverflow.com/a/64749403/376066 | ||
namespace System.Runtime.CompilerServices | ||
{ | ||
internal static class IsExternalInit { } | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters