Tools made in assistance of the Metacall Project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
820 B

  1. #include "lfhmap.hpp"
  2. #include <string>
  3. #include <iostream>
  4. #include <chrono>
  5. int main() {
  6. size_t v = 13;
  7. auto map = new mct20::lfhmap<size_t, size_t, 80000>();
  8. for(int a = 0; a < 250000; a++) {
  9. map->set(v, v);
  10. const size_t& t = map->get(v).value();
  11. if(t != v)
  12. return 1;
  13. v*=121;
  14. v+=17;
  15. }
  16. v = 13;
  17. auto start = std::chrono::high_resolution_clock::now();
  18. for(int a = 0; a < 250000; a++) {
  19. const size_t& t = map->get(v).value();
  20. if(t != v)
  21. return 1;
  22. v*=121;
  23. v+=17;
  24. }
  25. auto time = std::chrono::high_resolution_clock::now() - start;
  26. std::cout << "Test 03 took " << std::chrono::duration_cast<std::chrono::milliseconds>(time).count() << "ms" << std::endl;
  27. std::cout << "Per 1R " << std::chrono::duration_cast<std::chrono::nanoseconds>(time).count()/250000 << "ns" << std::endl;
  28. return 0;
  29. }