Golang boxing
This repository is used to dig into the ins and outs of Golang boxing.
Prerequisites
The examples in this repository require Golang 1.18beta1.
Print sizes
The following command prints the sizes of several, primitive and struct types:
go test
Please find the results of the above command for the following OS/architecture combinations:
Benchmark boxing
To reveal when boxing is used to add elements to a list of []interface{}
(aka []any
in Go 1.18beta1), execute the benchmark:
go test -bench . -run Box -benchmem -count 1
Please find the results of the above command for the following OS/architecture combinations: