Improve .debug_line parser performance

This commit is contained in:
Derek Parker
2014-07-14 21:41:15 -05:00
parent c546ea2ef7
commit 6b64296bca
5 changed files with 27 additions and 47 deletions

View File

@ -6,6 +6,8 @@ import (
"path/filepath"
"strings"
"testing"
"github.com/davecheney/profile"
)
func grabDebugLineSection(fp string, t *testing.T) []byte {
@ -91,3 +93,13 @@ func TestDebugLinePrologueParser(t *testing.T) {
t.Fatal("First entry not parsed correctly")
}
}
func BenchmarkLineParser(b *testing.B) {
defer profile.Start(profile.MemProfile).Stop()
data := grabDebugLineSection("../../_fixtures/testnextprog", nil)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = Parse(data)
}
}