Skip to content

Commit

Permalink
Merge pull request #197 from evanphx/f-perf
Browse files Browse the repository at this point in the history
Improve performance
  • Loading branch information
evanphx authored Jan 12, 2024
2 parents a9c085a + 7a438a6 commit 05c9526
Show file tree
Hide file tree
Showing 26 changed files with 10,183 additions and 103 deletions.
18 changes: 18 additions & 0 deletions v5/bench_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
Loading

0 comments on commit 05c9526

Please sign in to comment.