From 7f2adbe43a1c330f3232a1b8b3d5dbd7660f8b19 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Wed, 25 Jun 2025 15:54:19 +0700 Subject: [PATCH] test(flow): adds BenchmarkGetJSRuntime Signed-off-by: Dwi Siswanto --- pkg/tmplexec/flow/vm_benchmark_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkg/tmplexec/flow/vm_benchmark_test.go diff --git a/pkg/tmplexec/flow/vm_benchmark_test.go b/pkg/tmplexec/flow/vm_benchmark_test.go new file mode 100644 index 000000000..dd76e0068 --- /dev/null +++ b/pkg/tmplexec/flow/vm_benchmark_test.go @@ -0,0 +1,19 @@ +package flow_test + +import ( + "testing" + + "github.com/projectdiscovery/nuclei/v3/pkg/tmplexec/flow" + "github.com/projectdiscovery/nuclei/v3/pkg/types" +) + +func BenchmarkGetJSRuntime(b *testing.B) { + opts := types.DefaultOptions() + + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + runtime := flow.GetJSRuntime(opts) + flow.PutJSRuntime(runtime) + } +}