Skip to content

Commit

Permalink
add string
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbbit committed Jul 26, 2023
1 parent a9764db commit 9f97969
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion logger_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,34 @@ func BenchmarkAny(b *testing.B) {
wg.Wait()
b.StopTimer()
})
b.Run("str-in-go-with-stack", func(b *testing.B) {
wg := sync.WaitGroup{}
wg.Add(b.N)
defer stackGrower(1000).Done()
b.ResetTimer()
for i := 0; i < b.N; i++ {
go func() {
logger.Info("", String("some-string-longer-than-16", "yet-another-long-string"))
wg.Done()
}()
}
wg.Wait()
b.StopTimer()
})
b.Run("str-in-go-with-stack", func(b *testing.B) {
wg := sync.WaitGroup{}
wg.Add(b.N)
defer stackGrower(1000).Done()
b.ResetTimer()
for i := 0; i < b.N; i++ {
go func() {
logger.Info("", String("some-string-longer-than-16", "yet-another-long-string"))
wg.Done()
}()
}
wg.Wait()
b.StopTimer()
})
b.Run("errs-in-go-with-stack", func(b *testing.B) {
errs := []error{errors.New("this error")}
wg := sync.WaitGroup{}
Expand All @@ -338,7 +366,7 @@ func BenchmarkAny(b *testing.B) {
wg.Wait()
b.StopTimer()
})
b.Run("any-in-go-with-stack", func(b *testing.B) {
b.Run("errs-any-in-go-with-stack", func(b *testing.B) {
errs := []error{errors.New("this error")}
wg := sync.WaitGroup{}
wg.Add(b.N)
Expand Down

0 comments on commit 9f97969

Please sign in to comment.