摘要: 1 ngx_int_t 2 ngx_os_init(ngx_log_t *log) 3 { 4 ngx_time_t *tp; 5 ngx_uint_t n; 6 #if (NGX_HAVE_LEVEL1_DCACHE_LINESIZE) 7 long size; 8 #endif 9 10 #if 阅读全文
posted @ 2020-09-27 21:18 wa小怪兽 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 1. cacheline对齐 避免读取的数据跨越2个cacheline,结构体可以cacheline对齐,连续的数组可以尝试首地址cacheline对齐,但可能造成浪费。 2. 分支预测 可以使用likely/unlikely这样的宏,提高cacheline命中的概率。 存在多个条件判断时,根据几率 阅读全文
posted @ 2020-09-27 20:08 wa小怪兽 阅读(520) 评论(0) 推荐(0) 编辑