mirror of
https://github.com/go-delve/delve.git
synced 2025-11-01 20:20:40 +08:00
Improve .debug_line parser performance
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user