pupuk / blog

My New Blog. Record & Share. Focus on PHP, MySQL, Javascript and Golang.
MIT License
9 stars 2 forks source link

Go map的一些思考和结论 #30

Open pupuk opened 3 years ago

pupuk commented 3 years ago

image image Map声明了但未初始化,值是nil,不能给nil map里面的元素赋值,但是可以读取一个不存在的key

image image Map看来可以自动扩容

Map的key只要是可比较的,就能用做map的key

image

pupuk commented 3 years ago

Go map为什么是无序的?

pupuk commented 3 years ago

Go maps in action 官方文档 解剖Go语言map底层 主要是理解hmap和bmap的结构 直观、可视化的理解Golang Map go1.9新版本 并发安全的map使用及内部实现 golang下Map的使用和性能分析(勿滥用锁) 深度解密Go语言之map 宏观看 Go 语言中的 Map 内部这两篇文章值得深入学习,了解go map背后的原理