runtime : Callers and CallersFrames is expensive , can i cached CallersFrames 's result .

198 views
Skip to first unread message

kor zhao

unread,
Jul 27, 2021, 1:57:54 PM7/27/21
to golang-nuts
help

Ian Lance Taylor

unread,
Jul 27, 2021, 4:18:17 PM7/27/21
to kor zhao, golang-nuts
Sorry, I'm not sure exactly what you are asking.

The value returned by runtime.Callers is just a slice, and the value
returned by runtime.CallersFrames is an ordinary value. It's fine to
save those values however you like.

Ian

Ian Cottrell

unread,
Jul 27, 2021, 5:08:12 PM7/27/21
to golang-nuts
Not sure if it the same issue, but one problem is that runtime.CallersFrames returns a *Frames, which means it does an allocation. It would be nice to have a call that either returned a Frames by value, or one that takes a frame to reset and fill in.
Reply all
Reply to author
Forward
0 new messages