centralized performance resources

This commit is contained in:
Barrett Ruth 2026-01-10 12:21:52 -05:00
commit 50b15a1522
63 changed files with 328466 additions and 0 deletions

View file

@ -0,0 +1,24 @@
#include <chrono>
#include <iostream>
#include <print>
using namespace std;
constexpr static size_t TRIALS = 100000;
int main() {
chrono::microseconds diffs_ms{0};
for (size_t loop_var = 1; loop_var <= TRIALS; ++loop_var) {
auto t1 = chrono::high_resolution_clock::now();
auto t2 = chrono::high_resolution_clock::now();
diffs_ms += chrono::duration_cast<chrono::microseconds>(t2 - t1);
}
print("measuring the clock in c++ 23 {} trials had an average time duration "
"of: {} microseconds, or {} milliseconds",
TRIALS, diffs_ms / TRIALS,
chrono::duration_cast<chrono::milliseconds>(diffs_ms / TRIALS));
return 0;
}