| 1711 | } |
| 1712 | |
| 1713 | func BenchmarkInterpreterParallel(b *testing.B) { |
| 1714 | for _, tst := range testData(b) { |
| 1715 | prg, vars, err := program(b, &tst, Optimize(), CompileRegexConstants(MatchesRegexOptimization)) |
| 1716 | if tst.err != "" || tst.progErr != "" { |
| 1717 | continue |
| 1718 | } |
| 1719 | if err != nil { |
| 1720 | b.Fatal(err) |
| 1721 | } |
| 1722 | b.ResetTimer() |
| 1723 | b.Run(tst.name, |
| 1724 | func(b *testing.B) { |
| 1725 | b.RunParallel(func(pb *testing.PB) { |
| 1726 | for pb.Next() { |
| 1727 | prg.Eval(vars) |
| 1728 | } |
| 1729 | }) |
| 1730 | }) |
| 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | func TestInterpreter(t *testing.T) { |
| 1735 | for _, tst := range testData(t) { |