Skip to content

Instantly share code, notes, and snippets.

@constructor-s
Created January 13, 2018 01:22
Show Gist options
  • Save constructor-s/2a5a032e49c91e2538923334cde863d2 to your computer and use it in GitHub Desktop.
Save constructor-s/2a5a032e49c91e2538923334cde863d2 to your computer and use it in GitHub Desktop.
cout_speed_test.cpp
#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