Skip to content

Commit 5c8d867

Browse files
committed
Back to use unsafe to key comparison (still fastest way)
1 parent a2370dc commit 5c8d867

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

parser.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ func searchKeys(data []byte, keys ...string) int {
122122

123123
// if string is a Key, and key level match
124124
if data[i] == ':'{
125+
key := unsafeBytesToString(data[keyBegin:keyEnd])
126+
125127
if keyLevel == level-1 && // If key nesting level match current object nested level
126-
keys[level-1] == string(data[keyBegin:keyEnd]) {
128+
keys[level-1] == key {
127129
keyLevel++
128130
// If we found all keys in path
129131
if keyLevel == lk {

0 commit comments

Comments
 (0)