| 1898 | } |
| 1899 | |
| 1900 | func BenchmarkInterpreterParallel(b *testing.B) { |
| 1901 | for _, tst := range testData(b) { |
| 1902 | prg, vars, err := program(b, &tst, Optimize(), CompileRegexConstants(MatchesRegexOptimization)) |
| 1903 | if tst.err != "" || tst.progErr != "" { |
| 1904 | continue |
| 1905 | } |
| 1906 | if err != nil { |
| 1907 | b.Fatal(err) |
| 1908 | } |
| 1909 | b.ResetTimer() |
| 1910 | b.Run(tst.name, |
| 1911 | func(b *testing.B) { |
| 1912 | b.RunParallel(func(pb *testing.PB) { |
| 1913 | for pb.Next() { |
| 1914 | prg.Eval(vars) |
| 1915 | } |
| 1916 | }) |
| 1917 | }) |
| 1918 | } |
| 1919 | } |
| 1920 | |
| 1921 | func TestInterpreter(t *testing.T) { |
| 1922 | for _, tst := range testData(t) { |