This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source code for the post https://cppbenchmarks.wordpress.com/2020/11/10/float-division-vs-multiplication-speed/ | |
#include <array> | |
#include <chrono> | |
#include <numeric> | |
#include <iostream> | |
float doNotOptimizeAway = 0.0F; | |
template <int nElements> std::chrono::microseconds benchmarkMultiplicationF32() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <random> | |
#include <chrono> | |
#include <iomanip> | |
template <typename RandomEngineType> void benchmark_random_generator(const std::string &name) { | |
RandomEngineType generator; | |
std::uniform_int_distribution<> distribution(0, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source code for the post https://cppbenchmarks.wordpress.com/2020/08/25/benchmarking-stdvector-and-stdlist-sorting-performance/ | |
#include <vector> | |
#include <list> | |
#include <iostream> | |
#include <chrono> | |
#include <algorithm> | |
struct BloatedInt { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source code for the post https://cppbenchmarks.wordpress.com/2020/08/25/benchmarking-stdvector-and-stdlist-sorting-performance/ | |
#include <vector> | |
#include <list> | |
#include <iostream> | |
#include <chrono> | |
#include <algorithm> | |
using ElementType = int32_t; |