replace some fmt.Sprintfs with strconv

Teeny-tiny optimizations:

    BenchmarkSprintf-10       37735996    32.31  ns/op  0 B/op  0 allocs/op
    BenchmarkItoa-10         591945836     2.031 ns/op  0 B/op  0 allocs/op
    BenchmarkFormatUint-10   593701444     2.014 ns/op  0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-06-23 13:06:48 +02:00
parent 11a5dd8265
commit b76cd4d9fd
5 changed files with 7 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"strings"
"text/tabwriter"
"time"
@@ -207,7 +208,7 @@ var usageCommand = cli.Command{
var displaySize func(int64) string
if context.Bool("b") {
displaySize = func(s int64) string {
return fmt.Sprintf("%d", s)
return strconv.FormatInt(s, 10)
}
} else {
displaySize = func(s int64) string {