Zero Initialized Array
std::vector<int> arr;
arr.resize(100'000'000);
std::fill(arr.begin(), arr.end(), 0);
# Only measure this part
for (auto i = 0u; i < arr.size(); ++i) {
arr[i] = i;
}
std::vector<int> arr;
arr.resize(100'000'000);
# Only measure this part
for (auto i = 0u; i < arr.size(); ++i) {
arr[i] = i;
}
* The benchmark is run under Apple Macbook Air M2.
* For the full benchmark code, please refer here.