| 1918 | } |
| 1919 | |
| 1920 | func BenchmarkInterpreterParallel(b *testing.B) { |
| 1921 | for _, tst := range testData(b) { |
| 1922 | prg, vars, err := program(b, &tst, Optimize(), CompileRegexConstants(MatchesRegexOptimization)) |
| 1923 | if tst.err != "" || tst.progErr != "" { |
| 1924 | continue |
| 1925 | } |
| 1926 | if err != nil { |
| 1927 | b.Fatal(err) |
| 1928 | } |
| 1929 | b.ResetTimer() |
| 1930 | b.Run(tst.name, |
| 1931 | func(b *testing.B) { |
| 1932 | b.RunParallel(func(pb *testing.PB) { |
| 1933 | for pb.Next() { |
| 1934 | prg.Eval(vars) |
| 1935 | } |
| 1936 | }) |
| 1937 | }) |
| 1938 | } |
| 1939 | } |
| 1940 | |
| 1941 | func TestInterpreter(t *testing.T) { |
| 1942 | for _, tst := range testData(t) { |