2018-02-18 12:25:20 +00:00
|
|
|
package php5_test
|
|
|
|
|
|
|
|
import (
|
2020-12-20 12:26:26 +00:00
|
|
|
"io/ioutil"
|
2018-02-18 12:25:20 +00:00
|
|
|
"testing"
|
|
|
|
|
2021-07-30 18:01:34 +00:00
|
|
|
"github.com/VKCOM/php-parser/internal/php5"
|
|
|
|
"github.com/VKCOM/php-parser/internal/scanner"
|
|
|
|
"github.com/VKCOM/php-parser/pkg/conf"
|
|
|
|
"github.com/VKCOM/php-parser/pkg/version"
|
2018-02-18 12:25:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkPhp5(b *testing.B) {
|
2020-12-20 12:26:26 +00:00
|
|
|
src, err := ioutil.ReadFile("test.php")
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal("can not read test.php: " + err.Error())
|
|
|
|
}
|
2018-02-18 12:25:20 +00:00
|
|
|
|
|
|
|
for n := 0; n < b.N; n++ {
|
2021-02-13 21:54:34 +00:00
|
|
|
config := conf.Config{
|
2020-12-29 19:23:22 +00:00
|
|
|
Version: &version.Version{
|
|
|
|
Major: 5,
|
|
|
|
Minor: 6,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
lexer := scanner.NewLexer(src, config)
|
|
|
|
php5parser := php5.NewParser(lexer, config)
|
2018-04-10 12:23:13 +00:00
|
|
|
php5parser.Parse()
|
2018-02-18 12:25:20 +00:00
|
|
|
}
|
|
|
|
}
|