C++C++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]]... - 知识点目录
Posted songyuc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++C++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]]... - 知识点目录相关的知识,希望对你有一定的参考价值。
C++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]] Consequences - CppCon
1. 使用[likely]&[unlikely]优化switch语句 - [10:22]
2. A branch misprediction is costly
这里有一个比较奇特的现象:就是对排序后的数组进行遍历会比遍历一般数组快很多,即使是,【sort(先排序数组)+遍历】也会比【直接遍历数组】要快,
[subtitle]:
one of the most known questions in Stack Overflow discusses that the while is more efficient to go over a sorted container even if you add this sorting into the Benchmark and the reason is Branch Prediction…
以上是关于C++C++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]]... - 知识点目录的主要内容,如果未能解决你的问题,请参考以下文章