package main import ( "testing" "github.com/dop251/goja" ) func BenchmarkGojaNumericalCalculation(b *testing.B) { vm := goja.New() b.ResetTimer() for i := 0; i < b.N; i++ { vm.RunString("let sum = 0; for (let i = 1; i <= 1000000; i++) { sum += i; }") } } func BenchmarkGojaStringManipulation(b *testing.B) { vm := goja.New() b.ResetTimer() for i := 0; i < b.N; i++ { vm.RunString(`let result = ""; for (let i = 0; i < 10000; i++) { result += "a"; }`) } }