Skip to content

Commit

Permalink
more benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Russ Egan committed Jul 25, 2023
1 parent 5d62775 commit d062bc5
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,20 @@ func BenchmarkBigMerge(b *testing.B) {
for i := 0; i < 100; i++ {
s2 = append(s2, bigNestedMaps(fmt.Sprintf("water%v", i), 3))
}
// pp.Println("m1", m1)
b.ResetTimer()
for i := 0; i < b.N; i++ {
Merge(m1, m2)
}

b.Run("withCopy", func(b *testing.B) {
// pp.Println("m1", m1)
for i := 0; i < b.N; i++ {
Merge(m1, m2)
}
})

b.Run("noCopy", func(b *testing.B) {
// pp.Println("m1", m1)
for i := 0; i < b.N; i++ {
Merge(m1, m2, Copy(false))
}
})
}

func BenchmarkMerge(b *testing.B) {
Expand Down Expand Up @@ -1010,9 +1019,23 @@ func TestEmpty(t *testing.T) {

func BenchmarkEmpty(b *testing.B) {
var w Widget
for i := 0; i < b.N; i++ {
Empty(w)
}
b.Run("struct", func(b *testing.B) {
for i := 0; i < b.N; i++ {
Empty(w)
}
})

b.Run("largeValue", func(b *testing.B) {
for i := 0; i < b.N; i++ {
Empty(largeTestVal1)
}
})

b.Run("primitive", func(b *testing.B) {
for i := 0; i < b.N; i++ {
Empty(5)
}
})
}

func TestInternalNormalize(t *testing.T) {
Expand Down

0 comments on commit d062bc5

Please sign in to comment.