Skip to content

Commit

Permalink
Performance improvement and Primitive Object properties bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Nov 5, 2023
1 parent 19cdcc2 commit 1cad2ad
Show file tree
Hide file tree
Showing 19 changed files with 3,701 additions and 9 deletions.
17 changes: 17 additions & 0 deletions OtherTests/JIntPerfTests/JIntPerfTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\YantraJS.Core\YantraJS.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Include=".\Scripts\*.*" CopyToOutputDirectory="PreserveNewest" />
<None Include="..\Jint.Tests.CommonScripts\Scripts\**" CopyToOutputDirectory="PreserveNewest" LinkBase="Scripts" />
</ItemGroup>


</Project>
57 changes: 57 additions & 0 deletions OtherTests/JIntPerfTests/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using YantraJS.Core.FastParser;

public class Program
{

private static readonly Dictionary<string, string> _files = new()
{
{ "array-stress", null },
{ "evaluation", null },
{ "linq-js", null },
{ "minimal", null },
{ "stopwatch", null },
{ "dromaeo-3d-cube", null },
{ "dromaeo-core-eval", null },
{ "dromaeo-object-array", null },
{ "dromaeo-object-regexp", null },
{ "dromaeo-object-string", null },
{ "dromaeo-string-base64", null },
};

private static readonly string _dromaeoHelpers = @"
var startTest = function () { };
var test = function (name, fn) { fn(); };
var endTest = function () { };
var prep = function (fn) { fn(); };";


public static void Main()
{

var files = _files.Keys.ToList();

foreach(var fileName in files)
{
var script = File.ReadAllText($"Scripts/{fileName}.js");
if (fileName.Contains("dromaeo"))
{
script = _dromaeoHelpers + Environment.NewLine + Environment.NewLine + script;
}
_files[fileName] = script;
}

foreach (var item in files)
{
var content = _files[item];
var engine = new YantraJS.Core.JSContext();
// By default YantraJS is strict mode only, in strict mode
// unless you pass `this`, `this` in a global context is undefined.
engine.Eval(content, item + ".js", engine);
}
}
}

1 change: 1 addition & 0 deletions OtherTests/JIntPerfTests/Scripts/array-stress.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1cad2ad

Please sign in to comment.