It has only to do with the act of correct observation, and by I mean a physical contact with all sorts of objects through all the senses

Golang 一段代码性能的探究

golang concurrence performance

我们来看下面这样的一段代码 var arr []int64 func IncrArrItem(s, e int) { for i = 0; i < 200000000; i++ { arr[s]++ arr[e]++ } } Shell 这个代码的作用是对的数组中的第 s 和 e 位

CPU Cache 学习

the study of cpu cache

CPU Cache 是指 L1L2 和 L3 缓存,他们是用来缩短 CPU 访问内存时间的部件, 他们容量小于内存大于寄存器文件,但访问速度几乎接近处理器处理的速度. 缓存之所以能提高性能是利用局部原理提高内存的访问速度, 局部性原理是指程序具有访问局部区里的数据和代码的趋势, 通过在 CPU Ca

golang 指针操作

golang pointer operation

在 go 语言中每个变量都有自己的地址,记录变量地址的类型称为指针类型 & 获取变量的地址,生成一个 *T 的指针类型指向取值变量 x x 必须是可以寻址的 * 获取指针指向的值 如果指针是 nil 会 panic 如果变量不是指针类型会报编译错误 invalid operation canno