-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from AllenX2018/fix-issue-107
improve Set performance as #issue107 descripes
- Loading branch information
Showing
2 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package benchmark | ||
|
||
import ( | ||
"github.com/buger/jsonparser" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func BenchmarkSetLarge(b *testing.B) { | ||
b.ReportAllocs() | ||
|
||
keyPath := make([]string, 20000) | ||
for i := range keyPath { | ||
keyPath[i] = "keyPath" + strconv.Itoa(i) | ||
} | ||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
_, _ = jsonparser.Set(largeFixture, largeFixture, keyPath...) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters