diff --git a/v5/bench_test.go b/v5/bench_test.go new file mode 100644 index 0000000..d78a9f8 --- /dev/null +++ b/v5/bench_test.go @@ -0,0 +1,18 @@ +package jsonpatch + +import "testing" + +func BenchmarkMergePatch(b *testing.B) { + original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) + target := []byte(`{"name": "Jane", "age": 24}`) + alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`) + + patch, err := CreateMergePatch(original, target) + if err != nil { + panic(err) + } + + for n := 0; n < b.N; n++ { + MergePatch(alternative, patch) + } +}