aboutsummaryrefslogtreecommitdiff
path: root/src/strconv
AgeCommit message (Collapse)Author
2026-01-22all: update to Unicode 17Russ Cox
Process: - Disable unicode TestProperties. - Run UNICODE_VERSION=17.0.0 go -C ../src/golang.org/x/text generate - Run go generate strconv - Update unicode TestProperties by hand to add missing test cases. This will break x/text using the main repo until the corresponding x/text CL is submitted. It should not break anything else. For #77266. Change-Id: Ia3ffb5a81e212b991714eef70eebfca98a0c8aab Reviewed-on: https://go-review.googlesource.com/c/go/+/737420 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> TryBot-Bypass: Russ Cox <rsc@golang.org>
2026-01-20strconv: don't call internal Atoi twice in AtoiDaniel Müllner
Change-Id: I89a41bbc83fdf473399527a933d57794ce83f68a Reviewed-on: https://go-review.googlesource.com/c/go/+/737261 Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-10-29strconv: move all but Quote to internal/strconvRuss Cox
This will let low-level things depend on the canonical routines, even for floating-point printing. Change-Id: I31207dc6584ad90d4e365dbe6eaf20f8662ed22d Reviewed-on: https://go-review.googlesource.com/c/go/+/716000 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-23strconv: optimize int-to-decimal and use consistentlyRuss Cox
Integer-to-decimal conversion is hand-written in multiple places in this package, with different incomplete optimizations in different copies. This CL establishes a single implementation, formatBase10, accurately optimized for a variety of systems, and then uses it consistently. Removed the fastSmalls const, which has been true since 2017. Also renamed smallsString to smalls. benchmark \ host local linux-arm64 s7 linux-amd64 linux-ppc64le linux-s390x linux-arm s7:GOARCH=386 linux-386 vs base vs base vs base vs base vs base vs base vs base vs base vs base AppendFloat/Decimal ~ ~ ~ ~ ~ ~ +0.99% ~ ~ AppendFloat/Float ~ ~ ~ +2.67% ~ ~ -0.17% ~ ~ AppendFloat/Exp ~ ~ ~ ~ -5.01% -0.88% -0.14% ~ ~ AppendFloat/NegExp ~ ~ ~ +1.80% ~ -1.55% -0.67% ~ ~ AppendFloat/LongExp ~ ~ ~ -1.36% -2.34% ~ +0.41% ~ ~ AppendFloat/Big ~ ~ ~ -3.94% -2.66% -0.61% +1.01% ~ ~ AppendFloat/BinaryExp -5.86% -2.20% -3.27% -17.16% -6.89% ~ -61.81% -33.80% -27.61% AppendFloat/32Integer ~ ~ ~ ~ ~ ~ +0.74% ~ ~ AppendFloat/32ExactFraction ~ ~ ~ +2.96% ~ ~ +0.09% +1.62% ~ AppendFloat/32Point ~ ~ ~ ~ ~ ~ +1.31% ~ ~ AppendFloat/32Exp ~ ~ ~ ~ -4.05% ~ -0.05% ~ ~ AppendFloat/32NegExp ~ ~ ~ -0.86% -4.97% ~ +0.23% ~ ~ AppendFloat/32Shortest ~ ~ ~ ~ ~ ~ +0.72% ~ ~ AppendFloat/32Fixed8Hard +4.58% +1.94% +2.77% -4.39% ~ +4.39% -9.36% -11.97% -15.71% AppendFloat/32Fixed9Hard +4.52% +5.41% +4.13% +3.10% -4.84% +14.34% -3.83% -1.84% -6.42% AppendFloat/64Fixed1 +3.37% +3.45% +1.31% ~ +6.93% +4.79% -2.99% -2.07% -5.51% AppendFloat/64Fixed2 +3.44% +3.46% +0.80% ~ +6.03% +6.51% -3.07% -2.23% -6.47% AppendFloat/64Fixed3 +5.27% +3.06% ~ +2.08% ~ +6.20% -2.85% -3.07% -6.21% AppendFloat/64Fixed4 +7.82% +3.70% +2.25% +2.01% +5.18% +5.68% -2.18% -1.31% -3.55% AppendFloat/64Fixed12 +3.81% +3.67% ~ +3.91% ~ +5.71% -9.49% -12.13% -11.63% AppendFloat/64Fixed16 -6.26% -1.42% -3.37% -3.15% -2.03% +1.15% -16.18% -21.43% -20.40% AppendFloat/64Fixed12Hard ~ +2.34% -1.44% ~ -1.99% +9.96% -10.34% -13.89% -13.23% AppendFloat/64Fixed17Hard -3.86% -0.96% -3.23% -2.85% -5.54% +9.12% -15.76% -19.37% -18.01% AppendFloat/64Fixed18Hard ~ ~ -1.34% ~ ~ ~ ~ ~ ~ AppendFloat/Slowpath64 ~ ~ ~ ~ ~ -0.63% +0.94% ~ ~ AppendFloat/SlowpathDenormal64 ~ ~ ~ -0.96% ~ -0.53% +0.65% +1.08% ~ AppendUint -5.10% +2.64% -4.21% -8.75% -1.69% -9.73% -60.54% -18.30% -22.34% AppendUintVarlen/digits=1 +2.91% +4.79% -7.80% ~ +7.60% ~ -4.13% ~ +3.56% AppendUintVarlen/digits=2 ~ -0.36% ~ ~ ~ +0.99% -5.45% ~ +2.71% AppendUintVarlen/digits=3 -3.69% -9.19% -5.28% -11.24% -12.90% -28.62% -42.12% -43.20% -32.72% AppendUintVarlen/digits=4 -5.18% -14.79% -6.11% -11.44% -17.82% -31.59% -39.66% -40.86% -27.99% AppendUintVarlen/digits=5 ~ -8.76% -11.18% -15.73% -6.94% -16.84% -37.31% -40.43% -29.18% AppendUintVarlen/digits=6 -1.48% -8.18% -11.67% -15.29% -5.74% -16.51% -38.73% -39.42% -26.00% AppendUintVarlen/digits=7 -9.34% -9.38% -14.86% -18.42% -4.30% -12.42% -35.23% -38.90% -26.84% AppendUintVarlen/digits=8 -10.37% -8.50% -17.32% -17.57% -6.52% -21.17% -35.56% -37.64% -22.88% AppendUintVarlen/digits=9 -15.94% -10.40% -16.51% -21.68% -8.14% -12.55% -33.50% -36.50% -23.86% AppendUintVarlen/digits=10 -4.16% +7.58% -6.11% -7.51% -5.73% -7.21% -40.04% -26.20% -25.59% AppendUintVarlen/digits=11 -9.66% -3.38% -12.55% -14.52% -5.92% -16.85% -46.87% -34.70% -32.89% AppendUintVarlen/digits=12 -7.75% +3.13% -5.16% -11.19% -5.28% -9.87% -52.39% -33.95% -33.40% AppendUintVarlen/digits=13 -14.43% -6.62% -12.24% -16.02% -3.26% -18.73% -57.28% -33.80% -31.58% AppendUintVarlen/digits=14 -8.62% +0.74% -7.87% -13.63% -3.57% -10.55% -62.94% -34.30% -35.06% AppendUintVarlen/digits=15 -14.52% -6.86% -14.08% -17.37% -4.55% -23.38% -61.99% -33.33% -32.28% AppendUintVarlen/digits=16 -10.77% -2.06% -7.70% -15.64% -4.43% -13.30% -64.95% -33.08% -32.25% AppendUintVarlen/digits=17 -14.18% -8.84% -12.96% -18.62% -7.55% -21.40% -66.71% -31.96% -31.40% AppendUintVarlen/digits=18 -11.04% -3.66% -8.43% -16.19% -5.77% -11.42% -71.09% -31.44% -32.31% AppendUintVarlen/digits=19 -8.62% +0.33% -9.66% -12.56% -5.37% -11.96% -71.30% -23.09% -31.52% AppendUintVarlen/digits=20 -9.26% +0.36% -6.55% -12.95% -6.83% -13.41% -74.49% -31.80% -38.76% host: local │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 40.13n ± 2% 40.15n ± 2% ~ (p=0.773 n=40) AppendFloat/Float-4 56.98n ± 1% 57.27n ± 1% ~ (p=0.394 n=40) AppendFloat/Exp-4 61.46n ± 1% 61.52n ± 1% ~ (p=0.829 n=40) AppendFloat/NegExp-4 60.24n ± 1% 59.99n ± 2% ~ (p=0.912 n=40) AppendFloat/LongExp-4 62.09n ± 2% 62.37n ± 2% ~ (p=0.394 n=40) AppendFloat/Big-4 67.41n ± 1% 66.99n ± 1% ~ (p=0.292 n=40) AppendFloat/BinaryExp-4 32.27n ± 2% 30.38n ± 2% -5.86% (p=0.000 n=40) AppendFloat/32Integer-4 39.68n ± 1% 39.34n ± 1% ~ (p=0.233 n=40) AppendFloat/32ExactFraction-4 57.95n ± 1% 57.88n ± 2% ~ (p=0.900 n=40) AppendFloat/32Point-4 56.40n ± 1% 56.58n ± 2% ~ (p=0.196 n=40) AppendFloat/32Exp-4 63.12n ± 2% 63.39n ± 1% ~ (p=0.082 n=40) AppendFloat/32NegExp-4 59.64n ± 1% 60.29n ± 1% ~ (p=0.192 n=40) AppendFloat/32Shortest-4 51.58n ± 1% 51.98n ± 0% ~ (p=0.082 n=40) AppendFloat/32Fixed8Hard-4 39.91n ± 1% 41.74n ± 1% +4.58% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 43.56n ± 1% 45.53n ± 1% +4.52% (p=0.000 n=40) AppendFloat/64Fixed1-4 34.61n ± 2% 35.77n ± 2% +3.37% (p=0.000 n=40) AppendFloat/64Fixed2-4 33.91n ± 1% 35.07n ± 1% +3.44% (p=0.000 n=40) AppendFloat/64Fixed3-4 35.36n ± 1% 37.23n ± 1% +5.27% (p=0.000 n=40) AppendFloat/64Fixed4-4 33.95n ± 1% 36.60n ± 1% +7.82% (p=0.000 n=40) AppendFloat/64Fixed12-4 57.03n ± 1% 59.20n ± 2% +3.81% (p=0.000 n=40) AppendFloat/64Fixed16-4 51.82n ± 1% 48.58n ± 0% -6.26% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 48.32n ± 1% 49.00n ± 0% ~ (p=0.118 n=40) AppendFloat/64Fixed17Hard-4 57.40n ± 2% 55.18n ± 5% -3.86% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 3.298µ ± 1% 3.291µ ± 1% ~ (p=0.927 n=40) AppendFloat/Slowpath64-4 61.94n ± 3% 62.08n ± 3% ~ (p=0.324 n=40) AppendFloat/SlowpathDenormal64-4 59.94n ± 1% 59.82n ± 1% ~ (p=0.288 n=40) AppendUint-4 180.6n ± 2% 171.3n ± 2% -5.10% (p=0.000 n=40) AppendUintVarlen/digits=1-4 4.475n ± 0% 4.605n ± 0% +2.91% (p=0.000 n=40) AppendUintVarlen/digits=2-4 4.424n ± 1% 4.486n ± 1% ~ (p=0.025 n=40) AppendUintVarlen/digits=3-4 12.46n ± 4% 12.00n ± 4% -3.69% (p=0.000 n=40) AppendUintVarlen/digits=4-4 11.68n ± 2% 11.08n ± 2% -5.18% (p=0.000 n=40) AppendUintVarlen/digits=5-4 11.89n ± 0% 11.82n ± 0% ~ (p=0.001 n=40) AppendUintVarlen/digits=6-4 12.18n ± 0% 12.00n ± 0% -1.48% (p=0.000 n=40) AppendUintVarlen/digits=7-4 13.49n ± 2% 12.23n ± 2% -9.34% (p=0.000 n=40) AppendUintVarlen/digits=8-4 13.21n ± 1% 11.84n ± 2% -10.37% (p=0.000 n=40) AppendUintVarlen/digits=9-4 15.21n ± 2% 12.79n ± 2% -15.94% (p=0.000 n=40) AppendUintVarlen/digits=10-4 15.49n ± 3% 14.85n ± 2% -4.16% (p=0.000 n=40) AppendUintVarlen/digits=11-4 16.82n ± 1% 15.20n ± 1% -9.66% (p=0.000 n=40) AppendUintVarlen/digits=12-4 17.42n ± 2% 16.07n ± 3% -7.75% (p=0.000 n=40) AppendUintVarlen/digits=13-4 18.75n ± 2% 16.05n ± 2% -14.43% (p=0.000 n=40) AppendUintVarlen/digits=14-4 18.90n ± 1% 17.27n ± 2% -8.62% (p=0.000 n=40) AppendUintVarlen/digits=15-4 20.49n ± 2% 17.52n ± 1% -14.52% (p=0.000 n=40) AppendUintVarlen/digits=16-4 21.08n ± 1% 18.81n ± 1% -10.77% (p=0.000 n=40) AppendUintVarlen/digits=17-4 22.64n ± 1% 19.43n ± 1% -14.18% (p=0.000 n=40) AppendUintVarlen/digits=18-4 22.96n ± 2% 20.42n ± 3% -11.04% (p=0.000 n=40) AppendUintVarlen/digits=19-4 24.58n ± 0% 22.46n ± 0% -8.62% (p=0.000 n=40) AppendUintVarlen/digits=20-4 25.23n ± 2% 22.89n ± 0% -9.26% (p=0.000 n=40) geomean 33.23n 32.17n -3.18% host: linux-arm64 │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 61.13n ± 0% ¹ 61.15n ± 0% ¹ ~ (p=0.006 n=40) AppendFloat/Float-4 88.90n ± 0% ¹ 88.88n ± 0% ¹ ~ (p=0.528 n=40) AppendFloat/Exp-4 92.87n ± 0% ¹ 92.87n ± 0% ¹ ~ (p=0.795 n=40) AppendFloat/NegExp-4 93.06n ± 0% ¹ 93.10n ± 0% ¹ ~ (p=0.031 n=40) AppendFloat/LongExp-4 100.3n ± 0% ¹ 100.3n ± 0% ¹ ~ (p=0.184 n=40) AppendFloat/Big-4 105.5n ± 0% ¹ 105.6n ± 0% ¹ ~ (p=0.007 n=40) AppendFloat/BinaryExp-4 47.80n ± 0% ¹ 46.75n ± 0% ¹ -2.20% (p=0.000 n=40) AppendFloat/32Integer-4 61.24n ± 0% ¹ 61.24n ± 0% ¹ ~ (p=0.809 n=40) AppendFloat/32ExactFraction-4 85.63n ± 0% ¹ 85.69n ± 0% ¹ ~ (p=0.002 n=40) AppendFloat/32Point-4 83.23n ± 0% ¹ 83.24n ± 0% ¹ ~ (p=0.410 n=40) AppendFloat/32Exp-4 92.18n ± 0% ¹ 92.19n ± 0% ¹ ~ (p=0.104 n=40) AppendFloat/32NegExp-4 87.69n ± 0% ¹ 87.70n ± 0% ¹ ~ (p=0.106 n=40) AppendFloat/32Shortest-4 77.13n ± 0% ¹ 77.12n ± 0% ¹ ~ (p=0.599 n=40) AppendFloat/32Fixed8Hard-4 54.55n ± 0% ¹ 55.61n ± 0% ¹ +1.94% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 60.91n ± 0% ¹ 64.21n ± 0% ¹ +5.41% (p=0.000 n=40) AppendFloat/64Fixed1-4 51.37n ± 0% ¹ 53.14n ± 0% ¹ +3.45% (p=0.000 n=40) AppendFloat/64Fixed2-4 50.34n ± 0% ¹ 52.08n ± 0% ¹ +3.46% (p=0.000 n=40) AppendFloat/64Fixed3-4 50.91n ± 0% ¹ 52.47n ± 0% ¹ +3.06% (p=0.000 n=40) AppendFloat/64Fixed4-4 48.59n ± 0% ¹ 50.39n ± 0% ¹ +3.70% (p=0.000 n=40) AppendFloat/64Fixed12-4 81.00n ± 0% ¹ 83.98n ± 0% ¹ +3.67% (p=0.000 n=40) AppendFloat/64Fixed16-4 71.60n ± 0% ¹ 70.59n ± 0% ¹ -1.42% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 66.07n ± 0% ¹ 67.62n ± 0% ¹ +2.34% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 79.00n ± 0% ¹ 78.24n ± 0% ¹ -0.96% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 4.290µ ± 0% ¹ 4.291µ ± 0% ¹ ~ (p=0.674 n=40) AppendFloat/Slowpath64-4 97.87n ± 0% ¹ 97.88n ± 0% ¹ ~ (p=0.847 n=40) AppendFloat/SlowpathDenormal64-4 95.66n ± 0% ¹ 95.66n ± 0% ¹ ~ (p=0.519 n=40) AppendUint-4 269.2n ± 0% ¹ 276.3n ± 0% ¹ +2.64% (p=0.000 n=40) AppendUintVarlen/digits=1-4 6.106n ± 0% ¹ 6.398n ± 0% ¹ +4.79% (p=0.000 n=40) AppendUintVarlen/digits=2-4 6.082n ± 0% ¹ 6.060n ± 0% ¹ -0.36% (p=0.000 n=40) AppendUintVarlen/digits=3-4 13.39n ± 0% ¹ 12.16n ± 0% ¹ -9.19% (p=0.000 n=40) AppendUintVarlen/digits=4-4 15.01n ± 0% ¹ 12.79n ± 0% ¹ -14.79% (p=0.000 n=40) AppendUintVarlen/digits=5-4 15.92n ± 0% ¹ 14.52n ± 0% ¹ -8.76% (p=0.000 n=40) AppendUintVarlen/digits=6-4 16.25n ± 0% ¹ 14.92n ± 0% ¹ -8.18% (p=0.000 n=40) AppendUintVarlen/digits=7-4 18.71n ± 0% ¹ 16.96n ± 0% ¹ -9.38% (p=0.000 n=40) AppendUintVarlen/digits=8-4 18.94n ± 0% ¹ 17.33n ± 0% ¹ -8.50% (p=0.000 n=40) AppendUintVarlen/digits=9-4 21.73n ± 0% ¹ 19.47n ± 0% ¹ -10.40% (p=0.000 n=40) AppendUintVarlen/digits=10-4 22.02n ± 0% ¹ 23.69n ± 0% ¹ +7.58% (p=0.000 n=40) AppendUintVarlen/digits=11-4 24.85n ± 0% ¹ 24.01n ± 0% ¹ -3.38% (p=0.000 n=40) AppendUintVarlen/digits=12-4 25.21n ± 0% ¹ 26.00n ± 0% ¹ +3.13% (p=0.000 n=40) AppendUintVarlen/digits=13-4 28.01n ± 0% ¹ 26.15n ± 0% ¹ -6.62% (p=0.000 n=40) AppendUintVarlen/digits=14-4 28.36n ± 0% ¹ 28.57n ± 0% ¹ +0.74% (p=0.000 n=40) AppendUintVarlen/digits=15-4 31.20n ± 0% ¹ 29.06n ± 0% ¹ -6.86% (p=0.000 n=40) AppendUintVarlen/digits=16-4 31.55n ± 0% ¹ 30.90n ± 0% ¹ -2.06% (p=0.000 n=40) AppendUintVarlen/digits=17-4 35.05n ± 0% ¹ 31.95n ± 0% ¹ -8.84% (p=0.000 n=40) AppendUintVarlen/digits=18-4 35.50n ± 0% ¹ 34.20n ± 0% ¹ -3.66% (p=0.000 n=40) AppendUintVarlen/digits=19-4 38.22n ± 0% ¹ 38.34n ± 0% ¹ +0.33% (p=0.000 n=40) AppendUintVarlen/digits=20-4 38.68n ± 0% ¹ 38.82n ± 0% ¹ +0.36% (p=0.000 n=40) geomean 48.25n 47.59n -1.36% ¹ benchmarks vary in cpu host: s7 │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 23.81n ± 1% 23.76n ± 1% ~ (p=0.885 n=40) AppendFloat/Float-4 36.85n ± 1% 36.97n ± 1% ~ (p=0.002 n=40) AppendFloat/Exp-4 36.82n ± 1% 36.59n ± 1% ~ (p=0.292 n=40) AppendFloat/NegExp-4 37.44n ± 1% 37.41n ± 1% ~ (p=0.596 n=40) AppendFloat/LongExp-4 39.82n ± 1% 39.78n ± 1% ~ (p=0.025 n=40) AppendFloat/Big-4 41.94n ± 1% 41.81n ± 1% ~ (p=0.054 n=40) AppendFloat/BinaryExp-4 20.18n ± 1% 19.52n ± 0% -3.27% (p=0.000 n=40) AppendFloat/32Integer-4 23.88n ± 0% 23.92n ± 0% ~ (p=0.408 n=40) AppendFloat/32ExactFraction-4 36.45n ± 1% 36.26n ± 0% ~ (p=0.088 n=40) AppendFloat/32Point-4 35.23n ± 1% 35.33n ± 1% ~ (p=0.470 n=40) AppendFloat/32Exp-4 38.04n ± 1% 37.89n ± 1% ~ (p=0.885 n=40) AppendFloat/32NegExp-4 36.20n ± 0% 36.21n ± 1% ~ (p=0.923 n=40) AppendFloat/32Shortest-4 32.55n ± 0% 32.42n ± 1% ~ (p=0.238 n=40) AppendFloat/32Fixed8Hard-4 24.70n ± 0% 25.38n ± 1% +2.77% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 27.13n ± 0% 28.25n ± 1% +4.13% (p=0.000 n=40) AppendFloat/64Fixed1-4 21.40n ± 0% 21.68n ± 1% +1.31% (p=0.000 n=40) AppendFloat/64Fixed2-4 21.17n ± 0% 21.33n ± 1% +0.80% (p=0.001 n=40) AppendFloat/64Fixed3-4 22.09n ± 1% 22.29n ± 1% ~ (p=0.003 n=40) AppendFloat/64Fixed4-4 21.38n ± 1% 21.86n ± 1% +2.25% (p=0.000 n=40) AppendFloat/64Fixed12-4 35.17n ± 0% 35.28n ± 1% ~ (p=0.125 n=40) AppendFloat/64Fixed16-4 32.02n ± 1% 30.94n ± 1% -3.37% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 29.79n ± 1% 29.36n ± 0% -1.44% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 34.79n ± 1% 33.66n ± 0% -3.23% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 1.983µ ± 1% 1.956µ ± 1% -1.34% (p=0.000 n=40) AppendFloat/Slowpath64-4 38.15n ± 0% 37.84n ± 1% ~ (p=0.039 n=40) AppendFloat/SlowpathDenormal64-4 38.06n ± 1% 38.24n ± 1% ~ (p=0.025 n=40) AppendUint-4 121.0n ± 0% 115.9n ± 1% -4.21% (p=0.000 n=40) AppendUintVarlen/digits=1-4 2.557n ± 1% 2.358n ± 4% -7.80% (p=0.000 n=40) AppendUintVarlen/digits=2-4 2.387n ± 4% 2.405n ± 4% ~ (p=0.149 n=40) AppendUintVarlen/digits=3-4 6.198n ± 1% 5.871n ± 1% -5.28% (p=0.000 n=40) AppendUintVarlen/digits=4-4 6.196n ± 0% 5.817n ± 1% -6.11% (p=0.000 n=40) AppendUintVarlen/digits=5-4 6.773n ± 1% 6.016n ± 1% -11.18% (p=0.000 n=40) AppendUintVarlen/digits=6-4 6.948n ± 1% 6.136n ± 1% -11.67% (p=0.000 n=40) AppendUintVarlen/digits=7-4 8.157n ± 1% 6.944n ± 1% -14.86% (p=0.000 n=40) AppendUintVarlen/digits=8-4 8.364n ± 1% 6.915n ± 0% -17.32% (p=0.000 n=40) AppendUintVarlen/digits=9-4 9.740n ± 1% 8.132n ± 1% -16.51% (p=0.000 n=40) AppendUintVarlen/digits=10-4 9.836n ± 1% 9.235n ± 1% -6.11% (p=0.000 n=40) AppendUintVarlen/digits=11-4 11.000n ± 1% 9.620n ± 0% -12.55% (p=0.000 n=40) AppendUintVarlen/digits=12-4 11.14n ± 1% 10.57n ± 1% -5.16% (p=0.000 n=40) AppendUintVarlen/digits=13-4 12.30n ± 1% 10.79n ± 1% -12.24% (p=0.000 n=40) AppendUintVarlen/digits=14-4 12.44n ± 1% 11.46n ± 0% -7.87% (p=0.000 n=40) AppendUintVarlen/digits=15-4 13.71n ± 1% 11.78n ± 1% -14.08% (p=0.000 n=40) AppendUintVarlen/digits=16-4 13.82n ± 1% 12.76n ± 1% -7.70% (p=0.000 n=40) AppendUintVarlen/digits=17-4 14.97n ± 1% 13.03n ± 0% -12.96% (p=0.000 n=40) AppendUintVarlen/digits=18-4 15.36n ± 1% 14.06n ± 1% -8.43% (p=0.000 n=40) AppendUintVarlen/digits=19-4 16.40n ± 1% 14.81n ± 1% -9.66% (p=0.000 n=40) AppendUintVarlen/digits=20-4 16.48n ± 0% 15.40n ± 1% -6.55% (p=0.000 n=40) geomean 20.56n 19.65n -4.42% host: linux-amd64 │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 64.49n ± 0% 64.79n ± 2% ~ (p=0.169 n=40) AppendFloat/Float-4 95.98n ± 4% 98.54n ± 4% +2.67% (p=0.000 n=40) AppendFloat/Exp-4 97.10n ± 1% 97.99n ± 4% ~ (p=0.002 n=40) AppendFloat/NegExp-4 98.10n ± 0% 99.87n ± 4% +1.80% (p=0.000 n=40) AppendFloat/LongExp-4 106.7n ± 4% 105.3n ± 4% -1.36% (p=0.001 n=40) AppendFloat/Big-4 116.8n ± 3% 112.3n ± 4% -3.94% (p=0.001 n=40) AppendFloat/BinaryExp-4 57.70n ± 3% 47.79n ± 3% -17.16% (p=0.000 n=40) AppendFloat/32Integer-4 64.75n ± 3% 64.71n ± 3% ~ (p=0.700 n=40) AppendFloat/32ExactFraction-4 91.48n ± 2% 94.19n ± 3% +2.96% (p=0.000 n=40) AppendFloat/32Point-4 92.48n ± 2% 92.73n ± 4% ~ (p=0.389 n=40) AppendFloat/32Exp-4 103.6n ± 2% 103.4n ± 1% ~ (p=0.069 n=40) AppendFloat/32NegExp-4 95.16n ± 1% 94.33n ± 0% -0.86% (p=0.001 n=40) AppendFloat/32Shortest-4 85.43n ± 4% 84.89n ± 1% ~ (p=0.082 n=40) AppendFloat/32Fixed8Hard-4 64.42n ± 3% 61.59n ± 0% -4.39% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 69.74n ± 3% 71.91n ± 4% +3.10% (p=0.000 n=40) AppendFloat/64Fixed1-4 59.70n ± 3% 59.16n ± 4% ~ (p=0.051 n=40) AppendFloat/64Fixed2-4 58.73n ± 2% 58.03n ± 0% ~ (p=0.110 n=40) AppendFloat/64Fixed3-4 57.92n ± 4% 59.13n ± 4% +2.08% (p=0.000 n=40) AppendFloat/64Fixed4-4 55.21n ± 3% 56.33n ± 4% +2.01% (p=0.000 n=40) AppendFloat/64Fixed12-4 87.98n ± 3% 91.42n ± 1% +3.91% (p=0.000 n=40) AppendFloat/64Fixed16-4 80.05n ± 3% 77.52n ± 4% -3.15% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 75.03n ± 4% 74.99n ± 0% ~ (p=0.641 n=40) AppendFloat/64Fixed17Hard-4 87.45n ± 1% 84.96n ± 2% -2.85% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 4.903µ ± 3% 4.912µ ± 3% ~ (p=0.829 n=40) AppendFloat/Slowpath64-4 101.8n ± 1% 101.4n ± 4% ~ (p=0.268 n=40) AppendFloat/SlowpathDenormal64-4 101.0n ± 4% 100.1n ± 3% -0.96% (p=0.000 n=40) AppendUint-4 336.7n ± 1% 307.2n ± 0% -8.75% (p=0.000 n=40) AppendUintVarlen/digits=1-4 6.069n ± 1% 6.069n ± 1% ~ (p=0.904 n=40) AppendUintVarlen/digits=2-4 5.920n ± 3% 5.925n ± 3% ~ (p=0.010 n=40) AppendUintVarlen/digits=3-4 16.33n ± 1% 14.49n ± 2% -11.24% (p=0.000 n=40) AppendUintVarlen/digits=4-4 16.70n ± 2% 14.79n ± 2% -11.44% (p=0.000 n=40) AppendUintVarlen/digits=5-4 19.33n ± 1% 16.29n ± 1% -15.73% (p=0.000 n=40) AppendUintVarlen/digits=6-4 20.15n ± 2% 17.07n ± 1% -15.29% (p=0.000 n=40) AppendUintVarlen/digits=7-4 22.78n ± 2% 18.58n ± 1% -18.42% (p=0.000 n=40) AppendUintVarlen/digits=8-4 23.56n ± 3% 19.43n ± 2% -17.57% (p=0.000 n=40) AppendUintVarlen/digits=9-4 27.12n ± 3% 21.24n ± 3% -21.68% (p=0.000 n=40) AppendUintVarlen/digits=10-4 27.10n ± 2% 25.07n ± 3% -7.51% (p=0.000 n=40) AppendUintVarlen/digits=11-4 29.72n ± 3% 25.41n ± 3% -14.52% (p=0.000 n=40) AppendUintVarlen/digits=12-4 30.35n ± 3% 26.95n ± 4% -11.19% (p=0.000 n=40) AppendUintVarlen/digits=13-4 32.98n ± 0% 27.70n ± 3% -16.02% (p=0.000 n=40) AppendUintVarlen/digits=14-4 33.89n ± 2% 29.28n ± 3% -13.63% (p=0.000 n=40) AppendUintVarlen/digits=15-4 36.45n ± 3% 30.11n ± 1% -17.37% (p=0.000 n=40) AppendUintVarlen/digits=16-4 37.12n ± 0% 31.31n ± 1% -15.64% (p=0.000 n=40) AppendUintVarlen/digits=17-4 39.84n ± 1% 32.42n ± 0% -18.62% (p=0.000 n=40) AppendUintVarlen/digits=18-4 40.53n ± 0% 33.97n ± 3% -16.19% (p=0.000 n=40) AppendUintVarlen/digits=19-4 43.20n ± 4% 37.78n ± 0% -12.56% (p=0.000 n=40) AppendUintVarlen/digits=20-4 43.87n ± 1% 38.19n ± 0% -12.95% (p=0.000 n=40) geomean 54.70n 51.10n -6.58% host: linux-ppc64le │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 55.69n ± 3% 56.06n ± 3% ~ (p=0.821 n=40) AppendFloat/Float-4 79.23n ± 1% 77.13n ± 3% ~ (p=0.019 n=40) AppendFloat/Exp-4 91.14n ± 2% 86.58n ± 2% -5.01% (p=0.000 n=40) AppendFloat/NegExp-4 90.77n ± 1% 85.43n ± 6% ~ (p=0.003 n=40) AppendFloat/LongExp-4 93.40n ± 2% 91.21n ± 2% -2.34% (p=0.000 n=40) AppendFloat/Big-4 101.55n ± 3% 98.84n ± 2% -2.66% (p=0.000 n=40) AppendFloat/BinaryExp-4 45.16n ± 3% 42.05n ± 2% -6.89% (p=0.000 n=40) AppendFloat/32Integer-4 56.50n ± 3% 57.45n ± 2% ~ (p=0.821 n=40) AppendFloat/32ExactFraction-4 80.94n ± 2% 80.60n ± 1% ~ (p=0.106 n=40) AppendFloat/32Point-4 77.03n ± 3% 76.69n ± 2% ~ (p=0.242 n=40) AppendFloat/32Exp-4 92.44n ± 1% 88.70n ± 1% -4.05% (p=0.000 n=40) AppendFloat/32NegExp-4 89.50n ± 2% 85.06n ± 2% -4.97% (p=0.000 n=40) AppendFloat/32Shortest-4 74.63n ± 2% 72.75n ± 4% ~ (p=0.042 n=40) AppendFloat/32Fixed8Hard-4 58.18n ± 2% 56.86n ± 1% ~ (p=0.002 n=40) AppendFloat/32Fixed9Hard-4 64.17n ± 1% 61.06n ± 1% -4.84% (p=0.000 n=40) AppendFloat/64Fixed1-4 47.56n ± 2% 50.86n ± 1% +6.93% (p=0.000 n=40) AppendFloat/64Fixed2-4 47.87n ± 4% 50.75n ± 2% +6.03% (p=0.000 n=40) AppendFloat/64Fixed3-4 50.84n ± 2% 51.68n ± 1% ~ (p=0.014 n=40) AppendFloat/64Fixed4-4 46.29n ± 3% 48.69n ± 4% +5.18% (p=0.000 n=40) AppendFloat/64Fixed12-4 79.97n ± 1% 85.03n ± 4% ~ (p=0.001 n=40) AppendFloat/64Fixed16-4 73.18n ± 1% 71.70n ± 2% -2.03% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 68.41n ± 4% 67.06n ± 1% -1.99% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 81.02n ± 1% 76.54n ± 1% -5.54% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 5.184µ ± 0% 5.215µ ± 1% ~ (p=0.056 n=40) AppendFloat/Slowpath64-4 89.16n ± 2% 88.85n ± 2% ~ (p=0.405 n=40) AppendFloat/SlowpathDenormal64-4 84.27n ± 3% 84.38n ± 1% ~ (p=0.424 n=40) AppendUint-4 277.5n ± 1% 272.9n ± 1% -1.69% (p=0.000 n=40) AppendUintVarlen/digits=1-4 5.044n ± 3% 5.428n ± 1% +7.60% (p=0.000 n=40) AppendUintVarlen/digits=2-4 5.051n ± 1% 5.038n ± 2% ~ (p=0.613 n=40) AppendUintVarlen/digits=3-4 12.13n ± 4% 10.57n ± 2% -12.90% (p=0.000 n=40) AppendUintVarlen/digits=4-4 13.33n ± 3% 10.95n ± 1% -17.82% (p=0.000 n=40) AppendUintVarlen/digits=5-4 14.05n ± 2% 13.08n ± 3% -6.94% (p=0.000 n=40) AppendUintVarlen/digits=6-4 14.46n ± 2% 13.63n ± 2% -5.74% (p=0.000 n=40) AppendUintVarlen/digits=7-4 17.11n ± 4% 16.38n ± 1% -4.30% (p=0.000 n=40) AppendUintVarlen/digits=8-4 17.34n ± 5% 16.20n ± 1% -6.52% (p=0.000 n=40) AppendUintVarlen/digits=9-4 21.06n ± 2% 19.34n ± 2% -8.14% (p=0.000 n=40) AppendUintVarlen/digits=10-4 21.11n ± 2% 19.90n ± 1% -5.73% (p=0.000 n=40) AppendUintVarlen/digits=11-4 24.25n ± 4% 22.81n ± 1% -5.92% (p=0.000 n=40) AppendUintVarlen/digits=12-4 24.53n ± 3% 23.23n ± 2% -5.28% (p=0.000 n=40) AppendUintVarlen/digits=13-4 27.14n ± 5% 26.26n ± 1% -3.26% (p=0.000 n=40) AppendUintVarlen/digits=14-4 27.72n ± 6% 26.73n ± 0% -3.57% (p=0.000 n=40) AppendUintVarlen/digits=15-4 31.23n ± 3% 29.80n ± 1% -4.55% (p=0.000 n=40) AppendUintVarlen/digits=16-4 30.78n ± 3% 29.41n ± 1% -4.43% (p=0.000 n=40) AppendUintVarlen/digits=17-4 35.04n ± 1% 32.39n ± 0% -7.55% (p=0.000 n=40) AppendUintVarlen/digits=18-4 35.10n ± 7% 33.08n ± 0% -5.77% (p=0.000 n=40) AppendUintVarlen/digits=19-4 38.26n ± 6% 36.21n ± 0% -5.37% (p=0.000 n=40) AppendUintVarlen/digits=20-4 39.24n ± 3% 36.56n ± 0% -6.83% (p=0.000 n=40) geomean 46.39n 44.95n -3.11% host: linux-s390x │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 70.92n ± 0% ¹ 70.81n ± 1% ¹ ~ (p=0.668 n=40) AppendFloat/Float-4 111.5n ± 0% ¹ 111.8n ± 0% ¹ ~ (p=0.143 n=40) AppendFloat/Exp-4 119.1n ± 1% ¹ 118.1n ± 1% ¹ -0.88% (p=0.000 n=40) AppendFloat/NegExp-4 119.7n ± 0% ¹ 117.8n ± 0% ¹ -1.55% (p=0.000 n=40) AppendFloat/LongExp-4 128.1n ± 0% ¹ 127.8n ± 1% ¹ ~ (p=0.181 n=40) AppendFloat/Big-4 131.3n ± 1% ¹ 130.5n ± 1% ¹ -0.61% (p=0.001 n=40) AppendFloat/BinaryExp-4 58.47n ± 0% ¹ 58.29n ± 0% ¹ ~ (p=0.189 n=40) AppendFloat/32Integer-4 72.66n ± 0% ¹ 72.31n ± 1% ¹ ~ (p=0.012 n=40) AppendFloat/32ExactFraction-4 108.6n ± 0% ¹ 108.5n ± 1% ¹ ~ (p=0.754 n=40) AppendFloat/32Point-4 108.6n ± 1% ¹ 108.2n ± 0% ¹ ~ (p=0.073 n=40) AppendFloat/32Exp-4 116.9n ± 1% ¹ 117.8n ± 0% ¹ ~ (p=0.008 n=40) AppendFloat/32NegExp-4 117.9n ± 0% ¹ 118.0n ± 0% ¹ ~ (p=0.954 n=40) AppendFloat/32Shortest-4 107.7n ± 1% ¹ 107.0n ± 1% ¹ ~ (p=0.106 n=40) AppendFloat/32Fixed8Hard-4 71.77n ± 1% ¹ 74.92n ± 1% ¹ +4.39% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 73.49n ± 0% ¹ 84.03n ± 0% ¹ +14.34% (p=0.000 n=40) AppendFloat/64Fixed1-4 63.55n ± 1% ¹ 66.59n ± 1% ¹ +4.79% (p=0.000 n=40) AppendFloat/64Fixed2-4 61.74n ± 1% ¹ 65.77n ± 1% ¹ +6.51% (p=0.000 n=40) AppendFloat/64Fixed3-4 63.84n ± 2% ¹ 67.80n ± 1% ¹ +6.20% (p=0.000 n=40) AppendFloat/64Fixed4-4 60.41n ± 1% ¹ 63.84n ± 1% ¹ +5.68% (p=0.000 n=40) AppendFloat/64Fixed12-4 98.06n ± 0% ¹ 103.65n ± 0% ¹ +5.71% (p=0.000 n=40) AppendFloat/64Fixed16-4 86.71n ± 0% ¹ 87.70n ± 0% ¹ +1.15% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 80.62n ± 1% ¹ 88.65n ± 1% ¹ +9.96% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 89.77n ± 1% ¹ 97.96n ± 1% ¹ +9.12% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 4.791µ ± 0% ¹ 4.790µ ± 0% ¹ ~ (p=0.973 n=40) AppendFloat/Slowpath64-4 126.0n ± 0% ¹ 125.2n ± 0% ¹ -0.63% (p=0.000 n=40) AppendFloat/SlowpathDenormal64-4 121.7n ± 0% ¹ 121.1n ± 0% ¹ -0.53% (p=0.001 n=40) AppendUint-4 374.6n ± 1% ¹ 338.2n ± 0% ¹ -9.73% (p=0.000 n=40) AppendUintVarlen/digits=1-4 5.433n ± 0% ¹ 5.416n ± 0% ¹ ~ (p=0.032 n=40) AppendUintVarlen/digits=2-4 5.357n ± 0% ¹ 5.410n ± 0% ¹ +0.99% (p=0.000 n=40) AppendUintVarlen/digits=3-4 17.45n ± 0% ¹ 12.46n ± 0% ¹ -28.62% (p=0.000 n=40) AppendUintVarlen/digits=4-4 17.38n ± 0% ¹ 11.89n ± 0% ¹ -31.59% (p=0.000 n=40) AppendUintVarlen/digits=5-4 21.38n ± 0% ¹ 17.78n ± 1% ¹ -16.84% (p=0.000 n=40) AppendUintVarlen/digits=6-4 21.60n ± 0% ¹ 18.03n ± 1% ¹ -16.51% (p=0.000 n=40) AppendUintVarlen/digits=7-4 26.44n ± 0% ¹ 23.15n ± 0% ¹ -12.42% (p=0.000 n=40) AppendUintVarlen/digits=8-4 26.60n ± 0% ¹ 20.97n ± 1% ¹ -21.17% (p=0.000 n=40) AppendUintVarlen/digits=9-4 31.44n ± 0% ¹ 27.49n ± 0% ¹ -12.55% (p=0.000 n=40) AppendUintVarlen/digits=10-4 31.26n ± 1% ¹ 29.00n ± 0% ¹ -7.21% (p=0.000 n=40) AppendUintVarlen/digits=11-4 35.90n ± 0% ¹ 29.84n ± 0% ¹ -16.85% (p=0.000 n=40) AppendUintVarlen/digits=12-4 35.95n ± 0% ¹ 32.40n ± 0% ¹ -9.87% (p=0.000 n=40) AppendUintVarlen/digits=13-4 40.98n ± 0% ¹ 33.31n ± 0% ¹ -18.73% (p=0.000 n=40) AppendUintVarlen/digits=14-4 38.96n ± 0% ¹ 34.85n ± 0% ¹ -10.55% (p=0.000 n=40) AppendUintVarlen/digits=15-4 45.51n ± 0% ¹ 34.87n ± 0% ¹ -23.38% (p=0.000 n=40) AppendUintVarlen/digits=16-4 45.05n ± 0% ¹ 39.05n ± 0% ¹ -13.30% (p=0.000 n=40) AppendUintVarlen/digits=17-4 50.76n ± 0% ¹ 39.89n ± 0% ¹ -21.40% (p=0.000 n=40) AppendUintVarlen/digits=18-4 49.86n ± 1% ¹ 44.16n ± 0% ¹ -11.42% (p=0.000 n=40) AppendUintVarlen/digits=19-4 54.68n ± 0% ¹ 48.14n ± 0% ¹ -11.96% (p=0.000 n=40) AppendUintVarlen/digits=20-4 55.48n ± 0% ¹ 48.04n ± 0% ¹ -13.41% (p=0.000 n=40) geomean 62.00n 58.40n -5.80% ¹ benchmarks vary in cpu host: linux-arm │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 121.6n ± 0% 122.8n ± 0% +0.99% (p=0.000 n=40) AppendFloat/Float-4 209.1n ± 0% 208.8n ± 0% -0.17% (p=0.000 n=40) AppendFloat/Exp-4 208.8n ± 0% 208.5n ± 0% -0.14% (p=0.000 n=40) AppendFloat/NegExp-4 210.1n ± 0% 208.7n ± 0% -0.67% (p=0.000 n=40) AppendFloat/LongExp-4 217.5n ± 0% 218.4n ± 0% +0.41% (p=0.000 n=40) AppendFloat/Big-4 237.8n ± 0% 240.2n ± 0% +1.01% (p=0.000 n=40) AppendFloat/BinaryExp-4 226.90n ± 0% 86.66n ± 0% -61.81% (p=0.000 n=40) AppendFloat/32Integer-4 121.9n ± 0% 122.8n ± 0% +0.74% (p=0.000 n=40) AppendFloat/32ExactFraction-4 174.0n ± 0% 174.1n ± 0% +0.09% (p=0.000 n=40) AppendFloat/32Point-4 171.9n ± 0% 174.2n ± 0% +1.31% (p=0.000 n=40) AppendFloat/32Exp-4 195.4n ± 0% 195.3n ± 0% -0.05% (p=0.000 n=40) AppendFloat/32NegExp-4 174.0n ± 0% 174.4n ± 0% +0.23% (p=0.000 n=40) AppendFloat/32Shortest-4 167.5n ± 0% 168.7n ± 0% +0.72% (p=0.000 n=40) AppendFloat/32Fixed8Hard-4 115.4n ± 0% 104.6n ± 0% -9.36% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 144.9n ± 0% 139.3n ± 0% -3.83% (p=0.000 n=40) AppendFloat/64Fixed1-4 127.3n ± 0% 123.5n ± 0% -2.99% (p=0.000 n=40) AppendFloat/64Fixed2-4 123.6n ± 0% 119.8n ± 0% -3.07% (p=0.000 n=40) AppendFloat/64Fixed3-4 122.8n ± 0% 119.3n ± 0% -2.85% (p=0.000 n=40) AppendFloat/64Fixed4-4 114.5n ± 0% 112.0n ± 0% -2.18% (p=0.000 n=40) AppendFloat/64Fixed12-4 161.3n ± 0% 146.0n ± 0% -9.49% (p=0.000 n=40) AppendFloat/64Fixed16-4 168.7n ± 0% 141.4n ± 0% -16.18% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 152.3n ± 0% 136.6n ± 0% -10.34% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 182.7n ± 0% 153.9n ± 0% -15.76% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 7.976µ ± 0% 7.977µ ± 0% ~ (p=0.093 n=40) AppendFloat/Slowpath64-4 213.4n ± 0% 215.4n ± 0% +0.94% (p=0.000 n=40) AppendFloat/SlowpathDenormal64-4 214.0n ± 0% 215.4n ± 0% +0.65% (p=0.000 n=40) AppendUint-4 1526.0n ± 0% 602.1n ± 0% -60.54% (p=0.000 n=40) AppendUintVarlen/digits=1-4 9.338n ± 0% 8.953n ± 0% -4.13% (p=0.000 n=40) AppendUintVarlen/digits=2-4 9.789n ± 0% 9.256n ± 0% -5.45% (p=0.000 n=40) AppendUintVarlen/digits=3-4 46.42n ± 0% 26.87n ± 0% -42.12% (p=0.000 n=40) AppendUintVarlen/digits=4-4 49.23n ± 0% 29.70n ± 0% -39.66% (p=0.000 n=40) AppendUintVarlen/digits=5-4 51.45n ± 0% 32.25n ± 0% -37.31% (p=0.000 n=40) AppendUintVarlen/digits=6-4 51.02n ± 0% 31.26n ± 0% -38.73% (p=0.000 n=40) AppendUintVarlen/digits=7-4 55.45n ± 0% 35.91n ± 0% -35.23% (p=0.000 n=40) AppendUintVarlen/digits=8-4 57.11n ± 0% 36.80n ± 0% -35.56% (p=0.000 n=40) AppendUintVarlen/digits=9-4 59.28n ± 0% 39.42n ± 0% -33.50% (p=0.000 n=40) AppendUintVarlen/digits=10-4 71.62n ± 0% 42.94n ± 0% -40.04% (p=0.000 n=40) AppendUintVarlen/digits=11-4 91.41n ± 0% 48.57n ± 0% -46.87% (p=0.000 n=40) AppendUintVarlen/digits=12-4 106.50n ± 0% 50.70n ± 0% -52.39% (p=0.000 n=40) AppendUintVarlen/digits=13-4 121.90n ± 0% 52.07n ± 0% -57.28% (p=0.000 n=40) AppendUintVarlen/digits=14-4 129.70n ± 0% 48.07n ± 0% -62.94% (p=0.000 n=40) AppendUintVarlen/digits=15-4 148.50n ± 0% 56.45n ± 0% -61.99% (p=0.000 n=40) AppendUintVarlen/digits=16-4 167.40n ± 0% 58.67n ± 0% -64.95% (p=0.000 n=40) AppendUintVarlen/digits=17-4 179.70n ± 0% 59.83n ± 0% -66.71% (p=0.000 n=40) AppendUintVarlen/digits=18-4 186.00n ± 0% 53.78n ± 0% -71.09% (p=0.000 n=40) AppendUintVarlen/digits=19-4 216.50n ± 0% 62.13n ± 0% -71.30% (p=0.000 n=40) AppendUintVarlen/digits=20-4 246.80n ± 0% 62.96n ± 0% -74.49% (p=0.000 n=40) geomean 136.3n 95.52n -29.95% host: s7:GOARCH=386 │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 51.07n ± 1% 51.05n ± 0% ~ (p=0.346 n=40) AppendFloat/Float-4 94.44n ± 1% 95.05n ± 0% ~ (p=0.343 n=40) AppendFloat/Exp-4 97.89n ± 0% 98.59n ± 0% ~ (p=0.271 n=40) AppendFloat/NegExp-4 98.22n ± 1% 99.27n ± 0% ~ (p=0.283 n=40) AppendFloat/LongExp-4 100.3n ± 0% 101.4n ± 0% ~ (p=0.001 n=40) AppendFloat/Big-4 109.1n ± 0% 110.0n ± 1% ~ (p=0.141 n=40) AppendFloat/BinaryExp-4 53.98n ± 1% 35.74n ± 1% -33.80% (p=0.000 n=40) AppendFloat/32Integer-4 49.90n ± 0% 50.41n ± 0% ~ (p=0.005 n=40) AppendFloat/32ExactFraction-4 78.22n ± 0% 79.49n ± 0% +1.62% (p=0.000 n=40) AppendFloat/32Point-4 75.75n ± 1% 75.90n ± 0% ~ (p=0.119 n=40) AppendFloat/32Exp-4 89.74n ± 1% 90.58n ± 0% ~ (p=0.088 n=40) AppendFloat/32NegExp-4 79.34n ± 1% 80.22n ± 0% ~ (p=0.005 n=40) AppendFloat/32Shortest-4 74.46n ± 1% 74.43n ± 1% ~ (p=1.000 n=40) AppendFloat/32Fixed8Hard-4 47.28n ± 1% 41.62n ± 0% -11.97% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 64.92n ± 1% 63.72n ± 1% -1.84% (p=0.000 n=40) AppendFloat/64Fixed1-4 58.40n ± 1% 57.19n ± 1% -2.07% (p=0.000 n=40) AppendFloat/64Fixed2-4 55.79n ± 1% 54.55n ± 1% -2.23% (p=0.000 n=40) AppendFloat/64Fixed3-4 56.70n ± 1% 54.95n ± 0% -3.07% (p=0.000 n=40) AppendFloat/64Fixed4-4 51.85n ± 1% 51.18n ± 0% -1.31% (p=0.000 n=40) AppendFloat/64Fixed12-4 74.00n ± 0% 65.02n ± 0% -12.13% (p=0.000 n=40) AppendFloat/64Fixed16-4 80.23n ± 1% 63.04n ± 0% -21.43% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 70.64n ± 1% 60.83n ± 1% -13.89% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 86.02n ± 1% 69.36n ± 0% -19.37% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 3.736µ ± 1% 3.795µ ± 0% ~ (p=0.010 n=40) AppendFloat/Slowpath64-4 99.18n ± 1% 100.25n ± 0% ~ (p=0.003 n=40) AppendFloat/SlowpathDenormal64-4 97.35n ± 1% 98.41n ± 0% +1.08% (p=0.001 n=40) AppendUint-4 356.3n ± 1% 291.2n ± 0% -18.30% (p=0.000 n=40) AppendUintVarlen/digits=1-4 3.923n ± 0% 3.919n ± 1% ~ (p=0.061 n=40) AppendUintVarlen/digits=2-4 3.917n ± 1% 3.924n ± 0% ~ (p=0.048 n=40) AppendUintVarlen/digits=3-4 17.205n ± 0% 9.772n ± 0% -43.20% (p=0.000 n=40) AppendUintVarlen/digits=4-4 17.18n ± 0% 10.16n ± 1% -40.86% (p=0.000 n=40) AppendUintVarlen/digits=5-4 18.33n ± 1% 10.92n ± 0% -40.43% (p=0.000 n=40) AppendUintVarlen/digits=6-4 18.67n ± 1% 11.31n ± 0% -39.42% (p=0.000 n=40) AppendUintVarlen/digits=7-4 19.77n ± 1% 12.08n ± 0% -38.90% (p=0.000 n=40) AppendUintVarlen/digits=8-4 19.95n ± 1% 12.44n ± 1% -37.64% (p=0.000 n=40) AppendUintVarlen/digits=9-4 21.44n ± 1% 13.61n ± 1% -36.50% (p=0.000 n=40) AppendUintVarlen/digits=10-4 24.31n ± 0% 17.94n ± 0% -26.20% (p=0.000 n=40) AppendUintVarlen/digits=11-4 27.75n ± 1% 18.12n ± 0% -34.70% (p=0.000 n=40) AppendUintVarlen/digits=12-4 28.76n ± 1% 18.99n ± 0% -33.95% (p=0.000 n=40) AppendUintVarlen/digits=13-4 29.12n ± 1% 19.28n ± 0% -33.80% (p=0.000 n=40) AppendUintVarlen/digits=14-4 30.56n ± 0% 20.07n ± 1% -34.30% (p=0.000 n=40) AppendUintVarlen/digits=15-4 30.71n ± 1% 20.48n ± 0% -33.33% (p=0.000 n=40) AppendUintVarlen/digits=16-4 31.86n ± 0% 21.32n ± 0% -33.08% (p=0.000 n=40) AppendUintVarlen/digits=17-4 31.51n ± 1% 21.43n ± 1% -31.96% (p=0.000 n=40) AppendUintVarlen/digits=18-4 32.46n ± 0% 22.26n ± 1% -31.44% (p=0.000 n=40) AppendUintVarlen/digits=19-4 35.42n ± 1% 27.25n ± 1% -23.09% (p=0.000 n=40) AppendUintVarlen/digits=20-4 39.50n ± 2% 26.94n ± 1% -31.80% (p=0.000 n=40) geomean 48.59n 39.98n -17.73% host: linux-386 │ 428dc15ab39 │ c6ec0aa13de │ │ sec/op │ sec/op vs base │ AppendFloat/Decimal-4 148.4n ± 2% 147.8n ± 1% ~ (p=0.053 n=40) AppendFloat/Float-4 284.1n ± 2% 281.9n ± 1% ~ (p=0.001 n=40) AppendFloat/Exp-4 294.5n ± 3% 292.7n ± 1% ~ (p=0.035 n=40) AppendFloat/NegExp-4 295.4n ± 1% 295.9n ± 3% ~ (p=0.799 n=40) AppendFloat/LongExp-4 305.8n ± 2% 304.9n ± 2% ~ (p=0.186 n=40) AppendFloat/Big-4 340.1n ± 3% 340.8n ± 4% ~ (p=0.069 n=40) AppendFloat/BinaryExp-4 139.1n ± 0% 100.7n ± 1% -27.61% (p=0.000 n=40) AppendFloat/32Integer-4 149.2n ± 2% 148.4n ± 3% ~ (p=0.450 n=40) AppendFloat/32ExactFraction-4 247.1n ± 4% 249.9n ± 3% ~ (p=0.005 n=40) AppendFloat/32Point-4 231.5n ± 4% 233.9n ± 2% ~ (p=0.288 n=40) AppendFloat/32Exp-4 286.9n ± 3% 284.5n ± 0% ~ (p=0.015 n=40) AppendFloat/32NegExp-4 244.5n ± 1% 244.3n ± 4% ~ (p=0.637 n=40) AppendFloat/32Shortest-4 227.4n ± 0% 227.2n ± 1% ~ (p=0.161 n=40) AppendFloat/32Fixed8Hard-4 146.8n ± 1% 123.7n ± 2% -15.71% (p=0.000 n=40) AppendFloat/32Fixed9Hard-4 218.7n ± 3% 204.7n ± 1% -6.42% (p=0.000 n=40) AppendFloat/64Fixed1-4 194.3n ± 0% 183.7n ± 3% -5.51% (p=0.000 n=40) AppendFloat/64Fixed2-4 184.8n ± 1% 172.8n ± 0% -6.47% (p=0.000 n=40) AppendFloat/64Fixed3-4 186.1n ± 3% 174.6n ± 3% -6.21% (p=0.000 n=40) AppendFloat/64Fixed4-4 164.9n ± 3% 159.1n ± 3% -3.55% (p=0.000 n=40) AppendFloat/64Fixed12-4 233.9n ± 2% 206.7n ± 3% -11.63% (p=0.000 n=40) AppendFloat/64Fixed16-4 253.2n ± 4% 201.5n ± 1% -20.40% (p=0.000 n=40) AppendFloat/64Fixed12Hard-4 224.0n ± 1% 194.4n ± 1% -13.23% (p=0.000 n=40) AppendFloat/64Fixed17Hard-4 282.4n ± 2% 231.5n ± 4% -18.01% (p=0.000 n=40) AppendFloat/64Fixed18Hard-4 15.92µ ± 3% 15.73µ ± 2% ~ (p=0.172 n=40) AppendFloat/Slowpath64-4 305.2n ± 2% 300.0n ± 3% ~ (p=0.016 n=40) AppendFloat/SlowpathDenormal64-4 297.1n ± 2% 294.0n ± 1% ~ (p=0.075 n=40) AppendUint-4 1218.5n ± 1% 946.2n ± 1% -22.34% (p=0.000 n=40) AppendUintVarlen/digits=1-4 8.735n ± 2% 9.046n ± 3% +3.56% (p=0.000 n=40) AppendUintVarlen/digits=2-4 8.752n ± 1% 8.990n ± 1% +2.71% (p=0.000 n=40) AppendUintVarlen/digits=3-4 32.45n ± 2% 21.84n ± 1% -32.72% (p=0.000 n=40) AppendUintVarlen/digits=4-4 33.23n ± 1% 23.93n ± 3% -27.99% (p=0.000 n=40) AppendUintVarlen/digits=5-4 39.00n ± 3% 27.61n ± 2% -29.18% (p=0.000 n=40) AppendUintVarlen/digits=6-4 38.87n ± 2% 28.76n ± 2% -26.00% (p=0.000 n=40) AppendUintVarlen/digits=7-4 42.55n ± 1% 31.13n ± 3% -26.84% (p=0.000 n=40) AppendUintVarlen/digits=8-4 43.13n ± 3% 33.26n ± 1% -22.88% (p=0.000 n=40) AppendUintVarlen/digits=9-4 48.54n ± 3% 36.96n ± 1% -23.86% (p=0.000 n=40) AppendUintVarlen/digits=10-4 68.81n ± 1% 51.20n ± 1% -25.59% (p=0.000 n=40) AppendUintVarlen/digits=11-4 78.96n ± 1% 52.99n ± 1% -32.89% (p=0.000 n=40) AppendUintVarlen/digits=12-4 83.14n ± 2% 55.37n ± 2% -33.40% (p=0.000 n=40) AppendUintVarlen/digits=13-4 83.74n ± 1% 57.30n ± 2% -31.58% (p=0.000 n=40) AppendUintVarlen/digits=14-4 90.47n ± 1% 58.75n ± 3% -35.06% (p=0.000 n=40) AppendUintVarlen/digits=15-4 90.35n ± 3% 61.18n ± 1% -32.28% (p=0.000 n=40) AppendUintVarlen/digits=16-4 94.12n ± 1% 63.77n ± 2% -32.25% (p=0.000 n=40) AppendUintVarlen/digits=17-4 93.81n ± 0% 64.35n ± 3% -31.40% (p=0.000 n=40) AppendUintVarlen/digits=18-4 99.25n ± 1% 67.18n ± 3% -32.31% (p=0.000 n=40) AppendUintVarlen/digits=19-4 118.70n ± 0% 81.28n ± 1% -31.52% (p=0.000 n=40) AppendUintVarlen/digits=20-4 135.90n ± 1% 83.23n ± 1% -38.76% (p=0.000 n=40) geomean 140.3n 117.7n -16.12% Change-Id: If5e2151c397701b23dbc69f20e57b99728898e90 Reviewed-on: https://go-review.googlesource.com/c/go/+/712662 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-22strconv: clean up powers-of-10 table, testsRuss Cox
Both Eisel-Lemire and Ryu depend on a table of truncated 128-bit mantissas of powers of 10, and so will Dragonbox. This CL: - Moves the table to a separate file, so it doesn't look tied to Eisel-Lemire. - Introduces a uint128 type in math.go for the table values, since .Hi and .Lo are clearer than [1] and [0]. - Generates the table from a standalone generator pow10gen.go. - Adds a new pow10 function in math.go to handle table access details. - Factors a 64x128->192-bit multiply into umul192 in math.go. - Moves multiplication by log₁₀ 2 and log₂ 10 into math.go. - Introduces an import_test.go to avoid having to type differently cased names in test code versus regular code. - Introduces named constants for the floating-point size parameters. Previously these were only in the floatInfo global variables. - Changes the BenchmarkAppendUintVarlen subtest names to be more useful. Change-Id: I9826ee5f41c5c19be3b6a7c3c5f277ec6c23b39a Reviewed-on: https://go-review.googlesource.com/c/go/+/712661 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-10-21strconv: embed testdata in testRuss Cox
This makes it easier to run test binaries on remote machines. Change-Id: I3e5bc6cf10272a6743fd5d16ab1089d46f53232c Reviewed-on: https://go-review.googlesource.com/c/go/+/712660 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-13strconv: add tests that Java once mishandledRuss Cox
Change-Id: I372233d8494665b3300f9a186c883a4254435e1c Reviewed-on: https://go-review.googlesource.com/c/go/+/710617 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-09-03unicode/utf8: make DecodeRune{,InString} inlineableJulien Cretel
This change makes the fast path for ASCII characters inlineable in DecodeRune and DecodeRuneInString and removes most instances of manual inlining at call sites. Here are some benchmark results (no change to allocations): goos: darwin goarch: amd64 pkg: unicode/utf8 cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz │ old │ new │ │ sec/op │ sec/op vs base │ DecodeASCIIRune-8 2.4545n ± 2% 0.6253n ± 2% -74.52% (p=0.000 n=20) DecodeJapaneseRune-8 3.988n ± 1% 4.023n ± 1% +0.86% (p=0.050 n=20) DecodeASCIIRuneInString-8 2.4675n ± 1% 0.6264n ± 2% -74.61% (p=0.000 n=20) DecodeJapaneseRuneInString-8 3.992n ± 1% 4.001n ± 1% ~ (p=0.625 n=20) geomean 3.134n 1.585n -49.43% Note: when #61502 gets resolved, DecodeRune and DecodeRuneInString should be reverted to their idiomatic implementations. Fixes #31666 Updates #48195 Change-Id: I4be25c4f52417dc28b3a7bd72f1b04018470f39d GitHub-Last-Rev: 2e352a0045027e059be79cdb60241b5cf35fec71 GitHub-Pull-Request: golang/go#75181 Reviewed-on: https://go-review.googlesource.com/c/go/+/699675 Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-04-07strconv: use switch for '+'/'-' prefix handlingzhi.wang
Follow the approach used in strconv's readFloat, decimal.set, and Atoi, where leading '+' and '-' are handled using a switch for clarity and consistency. Change-Id: I41eff34ce90b5ac43fcdbc0bb88910d6d5fb4d39 GitHub-Last-Rev: 0c9d2efb5a828515fa00afdba8c436aa31fb0e53 GitHub-Pull-Request: golang/go#73185 Reviewed-on: https://go-review.googlesource.com/c/go/+/663257 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-24strconv: use builtin min function in commonPrefixLenIgnoreCaseJes Cok
To make code a bit simpler. Change-Id: I33b3e04bc810a4838584c477854ef612b355579a GitHub-Last-Rev: 6d5bbc2a2877193e1319b9e626f408eda399666e GitHub-Pull-Request: golang/go#71927 Reviewed-on: https://go-review.googlesource.com/c/go/+/651975 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2025-01-27strconv: adjust comment so that gofmt doesn't mung itIan Lance Taylor
Change-Id: I7fe5c6a0521d3c597eae0f3568942df1db9370b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/642497 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-12-17fmt, strconv: document that exponent is always two digitsIan Lance Taylor
Except for %b where it is only one. Fixes #70862 Change-Id: Ic423a799b73bfa534f4083f6544bb9cd639fef06 Reviewed-on: https://go-review.googlesource.com/c/go/+/636915 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-11-14strconv: cleanup old compiler bits.TrailingZeros workaroundJorropo
Since CL 599096 the compiler knows bits.TrailingZeros's maximum value based on the input type size. Since CL 603996 it knows it based on input's maximum value. Change-Id: Ib0d6b15a3ba6894d3e7e12b79b387ddbffabe370 Reviewed-on: https://go-review.googlesource.com/c/go/+/618715 Auto-Submit: Robert Griesemer <gri@google.com> Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
2024-10-16strconv: display format options as listSean Liao
Fixes #69890 Change-Id: I1da4eb76c008679a687f4faa4294fe32b5fc7f42 Reviewed-on: https://go-review.googlesource.com/c/go/+/620236 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-22strconv: document that Unquote("''") returns an empty stringYossef Hisham
Fixes #64280 Change-Id: I1ad84d85b666a2ef52dc6ecdecd508b4e7fe24a6 GitHub-Last-Rev: 6242027261f02c578a09f70fcb39a8cac259855c GitHub-Pull-Request: golang/go#68524 Reviewed-on: https://go-review.googlesource.com/c/go/+/599575 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-05-05strconv: use stringslite.Cloneqiulaidongfeng
Change-Id: Ifa3c022ad5453301573593a3d05e7b1d42b931ff GitHub-Last-Rev: a7468b068b5c7bcaa573042cf9d5c2732c0385f1 GitHub-Pull-Request: golang/go#67167 Reviewed-on: https://go-review.googlesource.com/c/go/+/583215 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Auto-Submit: Keith Randall <khr@golang.org>
2024-04-04strconv: add available godoc linkcui fliter
Change-Id: Iad58155f29a101fb72768b170c0c2c9d76b6041a Reviewed-on: https://go-review.googlesource.com/c/go/+/539357 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: qiu laidongfeng2 <2645477756@qq.com> Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-03-12strconv: use generics to reduce redundant helper functionsapocelipes
Benchstat shows there are no noticeable performance changes here. Change-Id: If2250334fe6664986f044cbaabfa1bfc84f871f7 GitHub-Last-Rev: d41a498d54483759b9c85c3d8efa848c0cc1bbd9 GitHub-Pull-Request: golang/go#66266 Reviewed-on: https://go-review.googlesource.com/c/go/+/570935 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-03-11strconv: use slices.BinarySearch to simplify makeisprint.goapocelipes
Change-Id: I9886a99f730b7616f6f8a5e6154e1beb7d3c79e6 GitHub-Last-Rev: 3f9dc7707377f79968e2dfcd206b83db21e60e60 GitHub-Pull-Request: golang/go#66242 Reviewed-on: https://go-review.googlesource.com/c/go/+/570535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2023-10-19all: drop old +build linesDmitri Shuralyov
Running 'go fix' on the cmd+std packages handled much of this change. Also update code generators to use only the new go:build lines, not the old +build ones. For #41184. For #60268. Change-Id: If35532abe3012e7357b02c79d5992ff5ac37ca23 Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/536237 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-13strconv: add example for QuotedPrefixJoe Tsai
Example can sometimes be more informative than additional prose. Fixes #46829 Change-Id: Ia5a5b121ad0b891026e77420d5f7f1b2c4a407da Reviewed-on: https://go-review.googlesource.com/c/go/+/336749 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-08-24strconv: add missing function name, avoid unnecessary raw stringLuka Krmpotić
Change-Id: Iecd68f69f5265f1a4ea41b90aa819ce68fe55908 GitHub-Last-Rev: 4d1f4a1bc2740fc19bbb4768009ccfea1c8eb5bc GitHub-Pull-Request: golang/go#62177 Reviewed-on: https://go-review.googlesource.com/c/go/+/521277 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-08-17strconv: rely on utf8.AppendRuneJoe Tsai
This is both simpler and more performant. Quote 268ns ± 5% 258ns ± 4% -3.70% (p=0.014 n=10+10) QuoteRune 28.9ns ± 3% 28.4ns ± 4% ~ (p=0.113 n=9+10) AppendQuote 165ns ± 3% 165ns ± 3% ~ (p=0.661 n=9+10) AppendQuoteRune 8.05ns ± 5% 7.75ns ± 7% ~ (p=0.065 n=10+9) Change-Id: Ib0ee332e970d4986026c05e5e0e368f41eff7977 Reviewed-on: https://go-review.googlesource.com/c/go/+/412338 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Robert Griesemer <gri@google.com>
2023-08-11strconv: use the built-in min/max functionqiulaidongfeng
Change-Id: Iab170943e6e80ffe08bb061e563c106b53740372 Change-Id: Iab170943e6e80ffe08bb061e563c106b53740372 GitHub-Last-Rev: 2964e03f1fbc499247bb6c3365475a91ef64547a GitHub-Pull-Request: golang/go#61828 Reviewed-on: https://go-review.googlesource.com/c/go/+/516875 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-03-25all: add a few links in package godocsDaniel Martí
I noticed the one in path/filepath while reading the docs, and the other ones were found via some quick grepping. Change-Id: I386f2f74ef816a6d18aa2f58ee6b64dbd0147c9e Reviewed-on: https://go-review.googlesource.com/c/go/+/478795 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-02-21strconv: add Atoi test cases with characters less than '0'Anuraag Agrawal
Change-Id: I35c0fe4e7e11b694ef07687d5e0532a2ab9ba213 GitHub-Last-Rev: e0a28f42367c2685d80bcc5c45294c0d2eae77fe GitHub-Pull-Request: golang/go#58575 Reviewed-on: https://go-review.googlesource.com/c/go/+/469035 Auto-Submit: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2023-02-06all: upgrade Unicode from 13.0.0 to 15.0.0weebney
Update unicode/tables.go to reflect changes in the Unicode Standard up to Unicode 15.0.0, released 13 Sept 2022. In order to accommodate this update, strconv/isPrint has been updated to reflect changes in printable characters. Also changed is template/exec_test.go for both text and html packages- in the test "TestJSEscaping", rune U+FDFF was used as a placeholder for an unprintable character. This codepoint was assigned and made printable in Unicode 14.0.0, breaking this test. It has been replaced with the assigned and never-printable U+FFFE to fix the test and provide resiliency in the future. This upgrade bypasses Unicode 14.0.0, but is compatible. Updates https://github.com/golang/go/issues/48621 Fixes https://github.com/golang/go/issues/55079 Change-Id: I40efd097eb746db0727ebf7437280916d1242e47 GitHub-Last-Rev: c8885cab7a0c23632e1e5a433b1e8d5634a45a30 GitHub-Pull-Request: golang/go#57265 Reviewed-on: https://go-review.googlesource.com/c/go/+/456837 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Rob Pike <r@golang.org>
2023-01-31strconv: show what fmt package uses for float printingKevin Burke
The strconv docs are not very helpful for people who just want to pick a reasonable default, for example the one used by the fmt package to show floats. Add an example illustrating what the fmt package uses. Change-Id: Iefefa70dfd4d4bfa9962a20654ee23662818ef38 Reviewed-on: https://go-review.googlesource.com/c/go/+/463980 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-10-26all: remove uses of rand.SeedRuss Cox
As of CL 443058, rand.Seed is not necessary to call, nor is it a particular good idea. For #54880. Change-Id: If9d70763622c09008599db8c97a90fcbe285c6f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/445395 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-30strconv: delete unused fieldcuiweixie
Change-Id: I1257270c55d69962988b6034e7341a9142a0c449 Reviewed-on: https://go-review.googlesource.com/c/go/+/436720 Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Run-TryBot: xie cui <523516579@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-15strconv: add a test case when base is illegalcui fliter
Increase unit test coverage of strconv/itoa.go from 83.8% to 85% Change-Id: I0abdfc70a3f06251106f229c12ffb105eeb43fc8 GitHub-Last-Rev: da9755368b5db41123c8f945fecedd135e9f894a GitHub-Pull-Request: golang/go#55014 Reviewed-on: https://go-review.googlesource.com/c/go/+/430137 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Jenny Rakoczy <jenny@golang.org> Reviewed-by: Jenny Rakoczy <jenny@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-09strconv: remove redundant type conversioncui fliter
Change-Id: I25c8e8b701d6489f360fea30d09090826276b950 GitHub-Last-Rev: c2c8319dd5fa2a53fe82b10ecbf45eb54b5d6a68 GitHub-Pull-Request: golang/go#54924 Reviewed-on: https://go-review.googlesource.com/c/go/+/428976 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-08-23strconv: optimize Parse for []byte argumentsJoe Tsai
When one has a []byte on hand, but desires to call the Parse functions, the conversion from []byte to string would allocate. var b []byte = ... v, err := strconv.ParseXXX(string(b), ...) This changes it such that the input string never escapes from any of the Parse functions. Together with the compiler optimization where the compiler stack allocates any string smaller than 32B this makes most valid inputs for strconv.ParseXXX(string(b), ...) not require an allocation for the input string. For example, the longest int64 or uint64 encoded in decimal is 20B. Also, the longest decimal formatting of a float64 in appendix B of RFC 8785 is 25B. Previously, this was not possible since the input leaked to the error, which causes the prover to give up and instead heap copy the []byte. We fix this by copying the input string in the error case. The advantage of this change is that you can now call strconv.ParseXXX with a []byte without allocations (most times) in the non-error case. The detriment is that the error-case now has an extra allocation. We should optimize for the non-error path, rather than the error path. The effects of this change is transitively seen through packages that must use strconv.ParseXXX on a []byte such as "encoding/json": name old time/op new time/op delta UnmarshalFloat64 186ns 157ns -15.89% (p=0.000 n=10+10) name old alloc/op new alloc/op delta UnmarshalFloat64 148B 144B -2.70% (p=0.000 n=10+10) name old allocs/op new allocs/op delta UnmarshalFloat64 2.00 1.00 -50.00% (p=0.000 n=10+10) In order for "encoding/json" to benefit, there needs to be a small change made to how "encoding/json" calls strconv.ParseXXX. That will be a future change. Credit goes to Jeff Wendling for a similar patch. Fixes #42429 Change-Id: I512d6927f965f82e95bd7ec14a28a587f23b7203 Reviewed-on: https://go-review.googlesource.com/c/go/+/345488 Reviewed-by: Martin Möhrmann <martin@golang.org> Run-TryBot: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Auto-Submit: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-24strconv: avoid panic on invalid call to FormatFloatRémy Oudompheng
Calling FormatFloat with an invalid value of fmt is expected to return a string containing '%' and the input fmt character. Since even before Go 1.0, the code has been panicking in the case where prec=0. Fixes #52187 Change-Id: I74fec601eedb7fe28efc5132c4253674661452aa Reviewed-on: https://go-review.googlesource.com/c/go/+/402817 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-06strconv: fix typo in atof.go90364136+butterfly1924@users.noreply.github.com
strings for 'NaN' -> string for 'NaN' Change-Id: Ia415644a1b651e6ef9996ad24dd9708a60e57dfc GitHub-Last-Rev: 877f1c3eb1dc885915ae75385c5d38ee6f5fd9b1 GitHub-Pull-Request: golang/go#53246 Reviewed-on: https://go-review.googlesource.com/c/go/+/410494 Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-06-04strconv: clarify ParseFloat accepts Go syntax for float literalsBen Hoyt
The documentation for strconv.ParseFloat mentions that it "accepts decimal and hexadecimal floating-point number syntax", but it doesn't specify what those formats entail. For example, "0x10" is not allowed; you need an explicit exponent, as in "0x10p0". This clarifies that ParseFloat accepts the Go syntax for floating-point literals, and links to that spec section. I've also linked to the relevant spec section for ParseInt's doc comment, which already said "as defined by the Go syntax for integer literals". Change-Id: Ib5d2b408bdd01ea0b9f69381a9dbe858f6d1d424 Reviewed-on: https://go-review.googlesource.com/c/go/+/410335 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-01all: remove trailing blank doc comment linesRuss Cox
A future change to gofmt will rewrite // Doc comment. // func f() to // Doc comment. func f() Apply that change preemptively to all doc comments. For #51082. Change-Id: I4023e16cfb0729b64a8590f071cd92f17343081d Reviewed-on: https://go-review.googlesource.com/c/go/+/384259 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31strconv: quote rune 007F as \x7f, not \u007fIan Lance Taylor
\u007f is not wrong but it's weird to use \u when we could use the shorter \x. Fixes #52062 Change-Id: Ica4bdc2463128051876f44e15297ed1e9edf1de8 Reviewed-on: https://go-review.googlesource.com/c/go/+/397255 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2022-03-16fmt, strconv: document use of Unicode replacement character in %qRuss Cox
Fixes #51526. Change-Id: I365a763454bd201f804df29f800416b1731b8ebc Reviewed-on: https://go-review.googlesource.com/c/go/+/390436 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-10-06all: use bytes.Cut, strings.CutRuss Cox
Many uses of Index/IndexByte/IndexRune/Split/SplitN can be written more clearly using the new Cut functions. Do that. Also rewrite to other functions if that's clearer. For #46336. Change-Id: I68d024716ace41a57a8bf74455c62279bde0f448 Reviewed-on: https://go-review.googlesource.com/c/go/+/351711 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-21strconv: reject surrogate halves in UnquoteJoe Tsai
Unquote implements unescaping a "single-quoted, doubled-quoted, or backquoted Go string literal". Therefore, it should reject anything that the Go specification explicitly forbids. The section on "Rune literals" explicitly rejects rune values "above 0x10FFFF and surrogate halves". We properly checked for the previous condition, but were failing to check for the latter. In general, "r > utf8.MaxRune" is probably the wrong check, while !utf8.ValidRune(r) is the more correct check. We make changes to both UnquoteChar and appendEscapedRune to use the correct check. The change to appendEscapedRune is technically a noop since callers of that function already guarantee that the provided rune is valid. Fixes #47853 Change-Id: Ib8977e56b91943ec8ada821b8d217b5e9a66f950 Reviewed-on: https://go-review.googlesource.com/c/go/+/343877 Trust: Joe Tsai <joetsai@digital-static.net> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2021-08-17all: fix typosYasuhiro Matsumoto
Change-Id: I83180c472db8795803c1b9be3a33f35959e4dcc2 Reviewed-on: https://go-review.googlesource.com/c/go/+/336889 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2021-06-09strconv: document parsing of leading +/-Damien Neil
Explicitly document the handling of a sign prefix, and the interaction between the sign and base prefixes. Fixes #46641. Change-Id: I3cd6773e3f074fe671a944a05a79d2408137fcd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/325875 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2021-06-07strconv: ParseFloat: always return ErrSyntax for bad syntaxIan Lance Taylor
Previously we would sometimes return ErrRange if the parseable part of the floating point number was out of range. Fixes #46628 Change-Id: I15bbbb1e2a56fa27c19fe25ab5554d988cbfd9d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/325750 Trust: Ian Lance Taylor <iant@golang.org> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-04strconv: fix a typoEndlessCheng
Change-Id: I17911dc95fb2126b41dc95f8839c4b3fa8f35d12 GitHub-Last-Rev: 88e120329301bd73db39e1081737a83f49a5672b GitHub-Pull-Request: golang/go#45933 Reviewed-on: https://go-review.googlesource.com/c/go/+/316689 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-04strconv: add QuotedPrefixJoe Tsai
QuotedPrefix is similar to Unquote, but returns the quoted string verbatim and ignores any data after the quoted string. Fixes #45033 Change-Id: I9f69fe9e3e45cbe9e63581cf1b457facb625045d Reviewed-on: https://go-review.googlesource.com/c/go/+/314775 Trust: Joe Tsai <joetsai@digital-static.net> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-27strconv: remove unused extfloat (Grisu3) ftoa codeRémy Oudompheng
Change-Id: Ie8995362f9e8072b173d08820330d2d1e512aa71 Reviewed-on: https://go-review.googlesource.com/c/go/+/314029 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-15strconv: Implement Ryū algorithm for ftoa shortest modeRémy Oudompheng
This patch implements the algorithm from Ulf Adams, "Ryū: Fast Float-to-String Conversion" (doi:10.1145/3192366.3192369) for formatting floating-point numbers with a fixed number of decimal digits. It is not a direct translation of the reference C implementation but still follows the original paper. In particular, it uses full 128-bit powers of 10, which allows for more precision in the other modes (fixed ftoa, atof). name old time/op new time/op delta AppendFloat/Decimal-4 49.6ns ± 3% 59.3ns ± 0% +19.59% (p=0.008 n=5+5) AppendFloat/Float-4 122ns ± 1% 91ns ± 1% -25.92% (p=0.008 n=5+5) AppendFloat/Exp-4 89.3ns ± 1% 100.0ns ± 1% +11.98% (p=0.008 n=5+5) AppendFloat/NegExp-4 88.3ns ± 2% 97.1ns ± 1% +9.87% (p=0.008 n=5+5) AppendFloat/LongExp-4 143ns ± 2% 103ns ± 0% -28.17% (p=0.016 n=5+4) AppendFloat/Big-4 144ns ± 1% 110ns ± 1% -23.26% (p=0.008 n=5+5) AppendFloat/BinaryExp-4 46.2ns ± 2% 46.0ns ± 1% ~ (p=0.603 n=5+5) AppendFloat/32Integer-4 49.1ns ± 1% 58.7ns ± 1% +19.57% (p=0.008 n=5+5) AppendFloat/32ExactFraction-4 95.6ns ± 1% 88.6ns ± 1% -7.30% (p=0.008 n=5+5) AppendFloat/32Point-4 122ns ± 1% 87ns ± 1% -28.63% (p=0.008 n=5+5) AppendFloat/32Exp-4 88.6ns ± 2% 95.0ns ± 1% +7.29% (p=0.008 n=5+5) AppendFloat/32NegExp-4 87.2ns ± 1% 91.3ns ± 1% +4.63% (p=0.008 n=5+5) AppendFloat/32Shortest-4 107ns ± 1% 82ns ± 0% -24.08% (p=0.008 n=5+5) AppendFloat/Slowpath64-4 1.00µs ± 1% 0.10µs ± 0% -89.92% (p=0.016 n=5+4) AppendFloat/SlowpathDenormal64-4 34.1µs ± 3% 0.1µs ± 1% -99.72% (p=0.008 n=5+5) Fixes #15672 Change-Id: Ib90dfa245f62490a6666671896013cf3f9a1fb22 Reviewed-on: https://go-review.googlesource.com/c/go/+/170080 Trust: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Nigel Tao <nigeltao@golang.org> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
2021-04-15strconv: implement Ryū-like algorithm for fixed precision ftoaRémy Oudompheng
This patch implements a simplified version of Ulf Adams, "Ryū: Fast Float-to-String Conversion" (doi:10.1145/3192366.3192369) for formatting floating-point numbers with a fixed number of decimal digits. It uses the same principles but does not need to handle the complex task of finding a shortest representation. This allows to handle a few more cases than Grisu3, notably formatting with up to 18 significant digits. name old time/op new time/op delta AppendFloat/32Fixed8Hard-4 72.0ns ± 2% 56.0ns ± 2% -22.28% (p=0.000 n=10+10) AppendFloat/32Fixed9Hard-4 74.8ns ± 0% 64.2ns ± 2% -14.16% (p=0.000 n=8+10) AppendFloat/64Fixed1-4 60.4ns ± 1% 54.2ns ± 1% -10.31% (p=0.000 n=10+9) AppendFloat/64Fixed2-4 66.3ns ± 1% 53.3ns ± 1% -19.54% (p=0.000 n=10+9) AppendFloat/64Fixed3-4 61.0ns ± 1% 55.0ns ± 2% -9.80% (p=0.000 n=9+10) AppendFloat/64Fixed4-4 66.9ns ± 0% 52.0ns ± 2% -22.20% (p=0.000 n=8+10) AppendFloat/64Fixed12-4 95.5ns ± 1% 76.2ns ± 3% -20.19% (p=0.000 n=10+9) AppendFloat/64Fixed16-4 1.62µs ± 0% 0.07µs ± 2% -95.69% (p=0.000 n=10+10) AppendFloat/64Fixed12Hard-4 1.27µs ± 1% 0.07µs ± 1% -94.83% (p=0.000 n=9+9) AppendFloat/64Fixed17Hard-4 3.68µs ± 1% 0.08µs ± 2% -97.86% (p=0.000 n=10+9) AppendFloat/64Fixed18Hard-4 3.67µs ± 0% 3.72µs ± 1% +1.44% (p=0.000 n=9+10) Updates #15672 Change-Id: I160963e141dd48287ad8cf57bcc3c686277788e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/170079 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Nigel Tao <nigeltao@golang.org> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>