From 9ecc1d167721beae16122737e1ce49e10cdcf060 Mon Sep 17 00:00:00 2001 From: "kayos@tcp.direct" Date: Fri, 10 Nov 2023 15:55:48 -0800 Subject: [PATCH] Fix[entropy]: Fix typo in docs and benchmark code --- entropy/entropy.go | 2 +- entropy/entropy_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/entropy/entropy.go b/entropy/entropy.go index 8c17b17..b66541a 100644 --- a/entropy/entropy.go +++ b/entropy/entropy.go @@ -152,7 +152,7 @@ randStr is an overoptimized (read: dummy fast) random string generator. at 55,555 characters, we are at: - ~57,000 bytes per op with string builders + ~57,000 bytes per op with byte builders vs ~210,000 bytes per op with string builders. diff --git a/entropy/entropy_test.go b/entropy/entropy_test.go index cbb69ef..5e78e64 100644 --- a/entropy/entropy_test.go +++ b/entropy/entropy_test.go @@ -168,13 +168,13 @@ func Test_RNGUint32(t *testing.T) { func Benchmark_RandStr(b *testing.B) { toTest := []int{5, 25, 55, 500, 55555} - for n := range toTest { + for _, ln := range toTest { for i := 1; i != 5; i++ { - b.Run(fmt.Sprintf("lenSeries%d/run%d", n, i), func(b *testing.B) { + b.Run(fmt.Sprintf("len%d/run%d", ln, i), func(b *testing.B) { b.ReportAllocs() b.ResetTimer() for tn := 0; tn != b.N; tn++ { - RandStr(n) + RandStr(ln) } }) }