diff --git a/dev/ast/node_test.go b/dev/ast/node_test.go index ce3e9fe46..31a42e0d8 100644 --- a/dev/ast/node_test.go +++ b/dev/ast/node_test.go @@ -7,6 +7,7 @@ import ( "strconv" "testing" + "github.com/bytedance/sonic/ast" "github.com/bytedance/sonic/internal/decoder" "github.com/davecgh/go-spew/spew" "github.com/stretchr/testify/require" @@ -65,9 +66,9 @@ func TestNodeParse(t *testing.T) { func BenchmarkNode_GetByPath(b *testing.B) { b.Run("10/2", func(b *testing.B) { - src := getSample(10, 1) + src := getSample(10, 0) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { _ = n.GetByPath("5") } @@ -75,7 +76,7 @@ func BenchmarkNode_GetByPath(b *testing.B) { b.Run("10/2/2", func(b *testing.B) { src := getSample(10, 1) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { x := n.GetByPath("5", "5") if x.Check() != nil { @@ -84,9 +85,9 @@ func BenchmarkNode_GetByPath(b *testing.B) { } }) b.Run("100/2", func(b *testing.B) { - src := getSample(100, 1) + src := getSample(100, 0) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { _ = n.GetByPath("50") } @@ -94,7 +95,7 @@ func BenchmarkNode_GetByPath(b *testing.B) { b.Run("100/2/2", func(b *testing.B) { src := getSample(100, 1) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { x := n.GetByPath("50", "50") if x.Check() != nil { @@ -103,9 +104,9 @@ func BenchmarkNode_GetByPath(b *testing.B) { } }) b.Run("1000/2", func(b *testing.B) { - src := getSample(1000, 1) + src := getSample(1000, 0) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { _ = n.GetByPath("500") } @@ -113,7 +114,7 @@ func BenchmarkNode_GetByPath(b *testing.B) { b.Run("1000/2/2", func(b *testing.B) { src := getSample(1000, 1) b.ResetTimer() - n, _ := NewParser(src).Parse() + n, _ := ast.NewParser(src).Parse() for i := 0; i < b.N; i++ { x := n.GetByPath("500", "500") if x.Check() != nil { diff --git a/dev/ast/parser.go b/dev/ast/parser.go index 41df6ca5e..9a5fd7725 100644 --- a/dev/ast/parser.go +++ b/dev/ast/parser.go @@ -22,7 +22,6 @@ import ( "github.com/bytedance/sonic/internal/native" "github.com/bytedance/sonic/internal/native/types" "github.com/bytedance/sonic/internal/rt" - "github.com/davecgh/go-spew/spew" ) type Parser struct { @@ -40,7 +39,6 @@ func (self *Parser) Pos() int { // parse one layer but no validate sub layers func (self *Parser) Parse() (Node, error) { node, err := parseLazy(self.src, nil) - spew.Dump(node.node) if err != nil { return Node{}, err }