aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorMichael Munday <mndygolang+git@gmail.com>2025-07-29 00:30:04 +0100
committerMichael Munday <mndygolang+git@gmail.com>2025-08-25 12:46:11 -0700
commit25c2d4109f5061425ca2633fb12450d43839bb79 (patch)
tree8807499e07fd842e59819ee34bf8c3db888b240c /src/runtime
parent4e05a070c4f88ebf43f0873e144c62d02d56060b (diff)
downloadgo-25c2d4109f5061425ca2633fb12450d43839bb79.tar.xz
math: use Trunc to implement Modf
By implementing Modf using Trunc, rather than the other way round, we can get a significant performance improvement on platforms where Trunc is implemented as an intrinsic. Trunc is implemented as an intrinsic on ppc64x and arm64 so the assembly implementations of Modf are no longer needed (the compiler can generate very similar code that can now potentially be inlined). GOAMD64=v1 goos: linux goarch: amd64 pkg: math cpu: 12th Gen Intel(R) Core(TM) i7-12700T │ sec/op │ sec/op vs base │ Gamma 4.257n ± 0% 3.890n ± 0% -8.61% (p=0.000 n=10) Modf 1.6110n ± 0% 0.4243n ± 0% -73.67% (p=0.000 n=10) geomean 2.619n 1.285n -50.94% GOAMD64=v2 goos: linux goarch: amd64 pkg: math cpu: 12th Gen Intel(R) Core(TM) i7-12700T │ sec/op │ sec/op vs base │ Gamma 4.100n ± 1% 3.717n ± 0% -9.35% (p=0.000 n=10) Modf 1.6070n ± 0% 0.2158n ± 1% -86.57% (p=0.000 n=10) geomean 2.567n 0.8957n -65.11% Change-Id: I689a560c344cf1d39ef002b540749bacc3179786 Reviewed-on: https://go-review.googlesource.com/c/go/+/694896 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions