Go Stack Allocated Variables Can Change Address
Due to Go compiler and runtime subtleties, some Go variables storage is allocated on goroutines’ call stacks.
Due to Go compiler and runtime subtleties, some Go variables storage is allocated on goroutines’ call stacks.
You can decide for yourself that an unholy alliance of the Go compiler and runtime can allocate variables on the call stack. But doing so forces you to notice the small initial size of a goroutine’s call stack: 0x1000, or 4096 bytes.
A Little Implementation Language
P. J. Plauger
ACM SIGPLAN Notices, Volume 11, Issue 4, Pages 135-137
The Go Blog has a post titled Allocating on the Stack. The post makes the claim that programs compiled with Go v1.26 compiler, and using the v1.26 runtime can allocate backing store of slices on the stack under some circumstances.
A long time ago, I worked at a company that has since merged with another large company. Back in the day, my employers kept a technical reference library that included back issues of a magazine, Software: Experience and Practice. A few of the earliest issues of that magazine had a “Computer Recreations” column. Volume 2, pages 397-400 had a column on self reproducing programs.
I came across an article by Brian Kernighan. The article is about a piece of C code written by Rob Pike, apparently for a book Pike and Kernighan wrote together, The Practice of Programming.
Wikipedia has this entry for Benford’s Law, which deals with the distribution of leading digits of a collection of samples.
Idly looking up a coding problem got me to investigate Dyck Languages, which led me to update my binary tree Go package.
There’s one more item I discovered during my mergesort investigation that bothers me. I wrote code that finishes with a low-to-high data value list. Starting with a “reverse sorted” (high-to-low data values) list with Wikipedia’s bottom up algorithm does not show the abrupt performance drops that a randomly-chosen data values initial list does, but has bumps in comparison count at lists of 2N+1 lengths.
Why is this?
I wrote a Go program this morning.
I thought of a super clever way to find the median
of a sorted slice of float64 types.
This clever way to do medians worked in the little
program I wrote first, because I strictly follow Gall’s Law.