summaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
authorsurechen <surechen17@gmail.com>2020-05-15 22:59:38 +0800
committerRobert Griesemer <gri@golang.org>2020-10-29 22:45:29 +0000
commitf588974a521d2626cba2a6ac3219c47eb3004aa1 (patch)
tree45a529c440e702ccf44f2c42f2867bc631dd9420 /src/strings
parentf43e012084c4edd381d21c9988638535696775ea (diff)
downloadgo-git-f588974a521d2626cba2a6ac3219c47eb3004aa1.tar.gz
math/big: reduce allocations for building decimal strings
Append operations in the decimal String function may cause several allocations. Use make to pre allocate slices in String that have enough capacity to avoid additional allocations in append operations. name old time/op new time/op delta DecimalConversion-8 139µs ± 7% 109µs ± 2% -21.06% (p=0.000 n=10+10) Change-Id: Id0284d204918a179a0421c51c35d86a3408e1bd9 Reviewed-on: https://go-review.googlesource.com/c/go/+/233980 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Giovanni Bajo <rasky@develer.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com> Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Giovanni Bajo <rasky@develer.com> Trust: Martin Möhrmann <moehrmann@google.com>
Diffstat (limited to 'src/strings')
0 files changed, 0 insertions, 0 deletions