perf: Improve jsonpath speed (#348)

This commit is contained in:
TwiN
2022-10-19 15:52:20 -04:00
committed by GitHub
parent 01d2ed3f02
commit 6a5fec2c55
3 changed files with 72 additions and 15 deletions

View File

@ -0,0 +1,11 @@
package jsonpath
import "testing"
func BenchmarkEval(b *testing.B) {
for i := 0; i < b.N; i++ {
Eval("ids[0]", []byte(`{"ids": [1, 2]}`))
Eval("long.simple.walk", []byte(`{"long": {"simple": {"walk": "value"}}}`))
Eval("data[0].apps[1].name", []byte(`{"data": [{"apps": [{"name":"app1"}, {"name":"app2"}, {"name":"app3"}]}]}`))
}
}