-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
Go version
go version go1.24.1 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/mzimmerman/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/mzimmerman/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build739745044=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/mzimmerman/timegarbage/go.mod'
GOMODCACHE='/home/mzimmerman/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/mzimmerman/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/snap/go/10866'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/mzimmerman/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/snap/go/10866/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
I have an application that deals with lots of different log files and events from disparate systems. The application is to correlate those activities together and so parsing times is important and relevant.
There's ~100 different log types many with their own (awful) format for time. I can't control the upstream applications; I've tried. The best I can do is support what they give me.
So, I have a lot of calls to time.Parse() that fail and I just repeat until I succeed (or eventually fail).
I am throwing away the error value and just checking if time.IsZero() for determining whether the call was successful or not and I did see the compiler optimize it some, but there's still a lot of garbage that is unneeded. Temporarily modifying the time library to not generate an error dropped memory usage significantly.
What did you see happen?
During parsing, the time library creates custom errors for each call such that it is the highest user of allocated memory in my entire application by 10x.
What did you expect to see?
Lower memory usage