From 128c6d51ec8c70e230dc86b100cb887ba3f0378d Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Thu, 20 Jan 2022 07:00:50 +0000 Subject: [PATCH] Secrets to macros and c string concat at compile time --- test.cpp | 35 +++++++++++++++++++++++++++++------ 1 files changed, 29 insertions(+), 6 deletions(-) diff --git a/test.cpp b/test.cpp index 843cbe3..b4c19b2 100644 --- a/test.cpp +++ b/test.cpp @@ -1,15 +1,38 @@ +#include "bom.hpp" #include "book.hpp" #include "json.hpp" #include "protocol.hpp" #include <chrono> +#include <iostream> +#include <unistd.h> +#include <unordered_map> + +constexpr int trials = 1000000; int main(void) { - // book::Book b = book::testBook(10, true); - auto bs = protocol::recoverBook(); - std::cout << bs.size() << std::endl; - for (auto i : bs) { - std::cout << i.first << std::endl; - i.second.printBook(); + std::chrono::nanoseconds time(0); + for (int i = 0; i < trials; i++) { + auto s = std::chrono::high_resolution_clock::now(); + book::Book b = book::testBook(100, false); + auto e = std::chrono::high_resolution_clock::now(); + time += e - s; } + std::cout << time.count() / trials << std::endl; + // auto bs = protocol::recoverBook(); + // protocol::catchUp(bs); + // std::cout << bs.size() << std::endl; + // for (auto i : bs) { + // std::cout << i.first << std::endl; + // i.second.printBook(); + // } + // bom::initialise(); + // bom::updateBom(bs); + // bom::destroy(); + // protocol::catchUp(bs); + // std::cout << bs.size() << std::endl; + // for (auto& i : bs) { + // std::cout << i.first << ", " << i.second.expiry.count() << ", " << + // i.second.bomPrice << std::endl; i.second.printBook(); + // } } -- Gitblit v1.9.3