2010年2月22日

popcount & google.sparsegroup

摘要: ubuntu+gcc4.3 ,尝试修改 google.sparsetable 中的 sparsegroup,修改完成,不启用 -mpopcnt,sparsetable_unittest 和 hashtable_unittest 都通过了。启用-mpopcnt以后,发现硬件不支持,报非法指令错误,公司的电脑太烂了!换到服务器上,是64位至强,gcc4.1.2,启用 -mpopcnt 再加 -O1/-O2/-O3 任何一个,导致编译失败:internal compiler error: in memory_address_length, at config/i386/i386.c:13816呜呼! 阅读全文

posted @ 2010-02-22 20:35 能发波 阅读(287) 评论(0) 推荐(0)

google.sparsegroup 可以更好

摘要: sparsegroup 是 google.sparseXXXX (sparsehashmap)系列中最底层的一个数据结构,sparseXXX 的互相依赖如下:-sparsegroup - sparsetable - sparsehashtable - sparse_hash_map - sparse_hash_set因此,sparsegroup 实现的性能直接关系到整个 sparseXXXX 系列。先看 sparsegroup 的一段代码:template class sparsegroup {// 省略 ..... typedef T value_type; typedef u_int... 阅读全文

posted @ 2010-02-22 13:29 能发波 阅读(320) 评论(0) 推荐(0)

tcmalloc 要点

摘要: google.tcmalloc线程缓存(threadcache)加锁(locking)加锁的开销是比较大的(cpu要同步cache),一般要几十个时钟周期,特别是cpu较多的时候,锁冲突概率大大增加。malloc不是在进入malloc就马上加锁,而是在thread cache耗尽后才加锁(用于从全局堆获取内存),加锁的频率被大大降低(通常情况下是几百倍)。free不是在每次free时都加锁,而是在free导致local cache空闲出整页内存时,才加锁将内存页交还给全局堆(globalheap)。radix-treetcmalloc使用的中心数据结构是radix-tree,这是trie-tr 阅读全文

posted @ 2010-02-22 11:33 能发波 阅读(227) 评论(0) 推荐(0)

导航