1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 var src
= readFile("parser.go")
15 func readFile(filename
string) []byte {
16 data
, err
:= ioutil
.ReadFile(filename
)
23 func BenchmarkParse(b
*testing
.B
) {
24 b
.SetBytes(int64(len(src
)))
25 for i
:= 0; i
< b
.N
; i
++ {
26 if _
, err
:= ParseFile(token
.NewFileSet(), "", src
, ParseComments
); err
!= nil {
27 b
.Fatalf("benchmark failed due to parse error: %s", err
)