diff --git a/Jint.Benchmark/ConstrainedExecutionBenchmark.cs b/Jint.Benchmark/ConstrainedExecutionBenchmark.cs new file mode 100644 index 000000000..e5cb62055 --- /dev/null +++ b/Jint.Benchmark/ConstrainedExecutionBenchmark.cs @@ -0,0 +1,44 @@ +using BenchmarkDotNet.Attributes; +using Jint.Native; + +namespace Jint.Benchmark; + +/// +/// Per-statement constraint check overhead: a registered timeout (the most common embedder +/// safety net) used to force a virtual Check() call before every executed statement and +/// disarm the tight for-body lane. The amortized-constraint partition reduces that to a +/// countdown decrement per statement and keeps the lane armed, so the TimeoutEnabled=true +/// row should track the unconstrained row closely. +/// +[MemoryDiagnoser] +public class ConstrainedExecutionBenchmark +{ + private Engine _engine = null!; + private Prepared