TGTGInsighttelegram intelligenceLIVE / telegram public index
Post content
帖子内容
测了下单线程 allocator 随机小 (de)alloc 的均摊性能,一对 alloc+dealloc (<=64B) 在 glibc 下大概是 15-20ns , mimalloc 大概是 7-8ns , slab 大概是 3-4ns 虽然说是有半个数量级的差距,但绝对数值上 alloc 还是比我想象中的要快好多,大多数情况下 slab 在性能上没什么大优势。 此外就是随着 peak allocation count 增加, slab 性能下降很快,到 len=8192 的时候性能和 mimalloc 就有来有回了。感觉是 slab 的简单 free list 没法抗碎片,对 cache 不友好,而且也缺乏 bitmap 之类的性能优化导致的。相对的,专业 allocator (包括 glibc )性能在内存占用上去之后也一直保持稳定,基本只和单个 allocation size 相关。 结论:早该治治 Box 恐惧症了。