Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ func Benchmark_FormatUint(b *testing.B) {
for _, input := range inputs {
b.Run(input.name+"/fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatUint(input.value)
for b.Loop() {
FormatUint(input.value)
}
})
b.Run(input.name+"/strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatUint(input.value, 10)
for b.Loop() {
strconv.FormatUint(input.value, 10)
}
})
}
Expand All @@ -181,14 +181,14 @@ func Benchmark_FormatInt(b *testing.B) {
for _, input := range inputs {
b.Run(input.name+"/fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatInt(input.value)
for b.Loop() {
FormatInt(input.value)
}
})
b.Run(input.name+"/strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatInt(input.value, 10)
for b.Loop() {
strconv.FormatInt(input.value, 10)
}
})
}
Expand All @@ -199,14 +199,14 @@ func Benchmark_FormatUint32(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatUint32(input)
for b.Loop() {
FormatUint32(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatUint(uint64(input), 10)
for b.Loop() {
strconv.FormatUint(uint64(input), 10)
}
})
}
Expand All @@ -216,14 +216,14 @@ func Benchmark_FormatInt32(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatInt32(input)
for b.Loop() {
FormatInt32(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatInt(int64(input), 10)
for b.Loop() {
strconv.FormatInt(int64(input), 10)
}
})
}
Expand All @@ -233,14 +233,14 @@ func Benchmark_FormatUint16(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatUint16(input)
for b.Loop() {
FormatUint16(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatUint(uint64(input), 10)
for b.Loop() {
strconv.FormatUint(uint64(input), 10)
}
})
}
Expand All @@ -250,14 +250,14 @@ func Benchmark_FormatInt16(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatInt16(input)
for b.Loop() {
FormatInt16(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatInt(int64(input), 10)
for b.Loop() {
strconv.FormatInt(int64(input), 10)
}
})
}
Expand All @@ -267,14 +267,14 @@ func Benchmark_FormatUint8(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatUint8(input)
for b.Loop() {
FormatUint8(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatUint(uint64(input), 10)
for b.Loop() {
strconv.FormatUint(uint64(input), 10)
}
})
}
Expand All @@ -284,14 +284,14 @@ func Benchmark_FormatInt8(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = FormatInt8(input)
for b.Loop() {
FormatInt8(input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.FormatInt(int64(input), 10)
for b.Loop() {
strconv.FormatInt(int64(input), 10)
}
})
}
Expand All @@ -302,14 +302,14 @@ func Benchmark_AppendUint(b *testing.B) {

b.Run("fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = AppendUint(dst, input)
for b.Loop() {
AppendUint(dst, input)
}
})
b.Run("strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.AppendUint(dst, input, 10)
for b.Loop() {
strconv.AppendUint(dst, input, 10)
}
})
}
Expand All @@ -327,14 +327,14 @@ func Benchmark_AppendInt(b *testing.B) {
for _, input := range inputs {
b.Run(input.name+"/fiber", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = AppendInt(dst, input.value)
for b.Loop() {
AppendInt(dst, input.value)
}
})
b.Run(input.name+"/strconv", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_ = strconv.AppendInt(dst, input.value, 10)
for b.Loop() {
strconv.AppendInt(dst, input.value, 10)
}
})
}
Expand Down
Loading