From 85a0d7453a541b1547678025210e7ddc55575f2e Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Tue, 14 Jun 2011 04:59:54 -0300 Subject: [PATCH] Playing with benchmarks. --- cxxmph/bm_map.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cxxmph/bm_map.cc b/cxxmph/bm_map.cc index 045c10a..95e76f7 100644 --- a/cxxmph/bm_map.cc +++ b/cxxmph/bm_map.cc @@ -13,6 +13,7 @@ namespace cxxmph { uint64_t myfind(const unordered_map& mymap, const uint64_t& k) { return mymap.find(k)->second; } + uint64_t myfind(const mph_map& mymap, const uint64_t& k) { return mymap.find(k)->second; } @@ -44,7 +45,11 @@ class BM_SearchUrls : public SearchUrlsBenchmark { : SearchUrlsBenchmark(urls_file, nsearches) { } virtual void Run() { for (auto it = random_.begin(); it != random_.end(); ++it) { - auto idx = myfind(mymap_, *it); + auto v = myfind(mymap_, *it); + if (v != *it) { + fprintf(stderr, "Looked for %s got %s\n", it->data(), v.data()); + exit(-1); + } } } protected: @@ -98,8 +103,8 @@ int main(int argc, char** argv) { Benchmark::Register(new BM_CreateUrls>("URLS100k")); */ Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000* 1000)); + Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000* 1000)); /* - Benchmark::Register(new BM_SearchUrls>("URLS100k", 1000* 1000)); Benchmark::Register(new BM_SearchUint64>); Benchmark::Register(new BM_SearchUint64>); */