Posted in

Go结构体字段对齐玄学:为什么加一个int8字段让struct大小从40B暴涨到64B?unsafe.Offsetof实测报告

第一章:Go结构体字段对齐玄学: … Go结构体字段对齐玄学:为什么加一个int8字段让struct大小从40B暴涨到64B?unsafe.Offsetof实测报告Read more

Posted in

Go语言结构体内存布局优化:如何让struct大小减少37%(基于go tool compile -S分析)

第一章:Go语言结构体内存布局优 … Go语言结构体内存布局优化:如何让struct大小减少37%(基于go tool compile -S分析)Read more

Posted in

Go结构体内存布局优化(align/padding/field order):实测字段重排使struct大小减少42.6%,QPS提升19.3%

第一章:Go结构体内存布局优化( … Go结构体内存布局优化(align/padding/field order):实测字段重排使struct大小减少42.6%,QPS提升19.3%Read more

Posted in

Go map值修改的编译期约束:为什么map[string]struct{X int}允许X++而map[string]struct{X [1000]int}会触发stack overflow警告?

第一章:Go map值修改的编译 … Go map值修改的编译期约束:为什么map[string]struct{X int}允许X++而map[string]struct{X [1000]int}会触发stack overflow警告?Read more