go涉猎
河流儿
这个作者很懒,什么都没留下…
展开
-
golang的加锁map与syncmap性能分析
syncmap是golang1.5引入的线程安全的map,以下是测试程序,结论: 不建议使用sync.map, 原因: 1. 性能不及加锁的map, 2. 对json不友好 测试程序: package main_test import ( "math/rand" "sync" "testing" ) type WrapedMap struct { lck sync.Mutex m ...原创 2020-03-23 16:15:59 · 2531 阅读 · 0 评论 -
go中struct实现多个接口.type会显示哪个接口
package main import ( "fmt" "reflect" ) type IntF1 interface { show1() string } type IntF2 interface { show2() string } type IntF3 interface { show3() string } type Cls struct { v1 string ...原创 2019-11-06 17:23:29 · 1195 阅读 · 0 评论