Skip to content

Commit 05c9526

Browse files
authored
Merge pull request #197 from evanphx/f-perf
Improve performance
2 parents a9c085a + 7a438a6 commit 05c9526

26 files changed

+10183
-103
lines changed

v5/bench_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package jsonpatch
2+
3+
import "testing"
4+
5+
func BenchmarkMergePatch(b *testing.B) {
6+
original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
7+
target := []byte(`{"name": "Jane", "age": 24}`)
8+
alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`)
9+
10+
patch, err := CreateMergePatch(original, target)
11+
if err != nil {
12+
panic(err)
13+
}
14+
15+
for n := 0; n < b.N; n++ {
16+
MergePatch(alternative, patch)
17+
}
18+
}

0 commit comments

Comments
 (0)