What version of Go are you using (go version)?
$ go version
go version go1.26.3 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/var/home/sjy/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/var/home/sjy/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4263466051=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/var/home/sjy/src/me/aegis/go.mod'
GOMODCACHE='/var/home/sjy/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/var/home/sjy/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/var/home/linuxbrew/.linuxbrew/Cellar/go/1.26.3/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/var/home/sjy/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/var/home/linuxbrew/.linuxbrew/Cellar/go/1.26.3/libexec/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.3'
GOWORK=''
PKG_CONFIG='pkg-config'
uname -sr: Linux 6.19.12-200.fc43.x86_64
LSB Version: n/a
Distributor ID: Bluefin
Description: Bluefin (Version: 43.20260505)
Release: 43
Codename: Deinonychus
/lib64/libc.so.6: GNU C Library (GNU libc) stable release version 2.42.
What did you do?
I wrote some simd/archsimd code to implement the AEGISx2 encryption algorithm.
I got pretty good performance (encryption of a 65k blob with a throughput of 1.5GB/s), but I knew that the C and Zig implementations had achieved much higher performance.
I then manually inlined 2 functions (UpdateState128x2, and Enc128x2), and manually hoisted my working set of SIMD variables out of a struct into local variables (aka a manual SROA optimization): diff.
With that change, I got a significant boost in performance (encryption of a 65k blob with a throughput of 28.5GB/s).
What did you expect to see?
I expected the compiler to automatically inline these functions, apply SROA-based optimization and have the high performance with the straightforward code.
What did you see instead?
Required manual optimization.
Here are the instructions to reproduce:
go mod init example.com/repro
# Performance without manual inlining.
go get github.com/balasanjay/aegis@14a5c57a492ba15937c79798495a515f8ec87aea
GOAMD64=v3 GOEXPERIMENT=simd go test github.com/balasanjay/aegis/... -bench . -count=1
# Performance with manual inlining
go get github.com/balasanjay/aegis@3de416051d0e9a17a643a38cd7d686a7a5b199f3
GOAMD64=v3 GOEXPERIMENT=simd go test github.com/balasanjay/aegis/... -bench . -count=1
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I wrote some
simd/archsimdcode to implement the AEGISx2 encryption algorithm.I got pretty good performance (encryption of a 65k blob with a throughput of 1.5GB/s), but I knew that the C and Zig implementations had achieved much higher performance.
I then manually inlined 2 functions (
UpdateState128x2, andEnc128x2), and manually hoisted my working set of SIMD variables out of a struct into local variables (aka a manual SROA optimization): diff.With that change, I got a significant boost in performance (encryption of a 65k blob with a throughput of 28.5GB/s).
What did you expect to see?
I expected the compiler to automatically inline these functions, apply SROA-based optimization and have the high performance with the straightforward code.
What did you see instead?
Required manual optimization.
Here are the instructions to reproduce: