diff --git a/Jint.Benchmark/FunctionLocalNumberLoopBenchmark.cs b/Jint.Benchmark/FunctionLocalNumberLoopBenchmark.cs new file mode 100644 index 000000000..499be63ca --- /dev/null +++ b/Jint.Benchmark/FunctionLocalNumberLoopBenchmark.cs @@ -0,0 +1,98 @@ +using BenchmarkDotNet.Attributes; +using Jint.Native; + +namespace Jint.Benchmark; + +/// +/// Function-local numeric loop patterns: accumulators and counters held in declarative +/// environment slots. These are the workloads where transient JsNumber allocations dominate +/// (values outside the int cache allocate per write), which the rest of the suite under-covers +/// because its loops live at script top level where bindings are global-object properties. +/// +[MemoryDiagnoser] +public class FunctionLocalNumberLoopBenchmark +{ + private Engine _engine = null!; + private Prepared