diff --git a/Jint.Benchmark/Jint.Benchmark.csproj b/Jint.Benchmark/Jint.Benchmark.csproj index 9de1514c17..ca35b14b95 100644 --- a/Jint.Benchmark/Jint.Benchmark.csproj +++ b/Jint.Benchmark/Jint.Benchmark.csproj @@ -21,6 +21,7 @@ + diff --git a/Jint.Benchmark/PreparedScriptBenchmark.cs b/Jint.Benchmark/PreparedScriptBenchmark.cs new file mode 100644 index 0000000000..f7bd91d8af --- /dev/null +++ b/Jint.Benchmark/PreparedScriptBenchmark.cs @@ -0,0 +1,71 @@ +using BenchmarkDotNet.Attributes; + +namespace Jint.Benchmark; + +/// +/// Replicates the exact pattern from JavaScriptEngineSwitcher's JsExecutionHeavyBenchmark: +/// a Handlebars template rendering library is loaded on 4 separate engine instances, +/// each calling renderTemplate() with different content items. +/// See: https://github.com/Taritsyn/JavaScriptEngineSwitcher/blob/master/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionHeavyBenchmark.cs +/// +[MemoryDiagnoser] +public class PreparedScriptBenchmark +{ + private string _libraryCode = null!; + private Prepared