Created
January 13, 2018 01:22
-
-
Save constructor-s/2a5a032e49c91e2538923334cde863d2 to your computer and use it in GitHub Desktop.
cout_speed_test.cpp
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 <chrono> | |
using namespace std; | |
using namespace std::chrono; | |
int main() | |
{ | |
const int N = 100000; | |
auto clock = high_resolution_clock(); | |
auto start = clock.now(); | |
for (size_t i = 0; i < N; i++) | |
{ | |
cout << '.'; | |
} | |
cout << endl; | |
auto end = clock.now(); | |
auto count = duration_cast<microseconds>(end - start).count() * 1.0 / N; | |
cout << count << " microseconds per loop" << endl; | |
// string _; getline(cin, _); | |
return count; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment