Skip to content
Permalink
Browse files

Fix benchmark code

  • Loading branch information...
bobbymcr committed Jun 8, 2019
1 parent af55386 commit a2913f1755e136d8fd95fedae6720784acf8a434
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/Words.Benchmark.Native/Main.cpp
@@ -71,9 +71,9 @@ void Fill(Hashtable<string, int>& table, int n)
}
}

void Insert(int n, float loadFactor)
void Insert(Hashtable<string, int>& table, int n, float f)
{
Hashtable<string, int> table(loadFactor);
table = Hashtable<string, int>(f);
Fill(table, n);
}

@@ -93,7 +93,7 @@ int FindPresent(const Hashtable<string, int>& table, int n)
}
}

return 0;
return sum;
}

int FindMissing(const Hashtable<string, int>& table, int n)
@@ -113,7 +113,7 @@ int FindMissing(const Hashtable<string, int>& table, int n)
}
}

return 0;
return sum;
}

int main()
@@ -125,11 +125,11 @@ int main()
for (int j = 1; j <= 5; ++j)
{
n *= 10;
Hashtable<string, int> table(f);
stringstream s;
s << " Insert_1e" << j << "_" << i << "/4";
Measure(s.str().c_str(), [n, f]() { Insert(n, f); });
Measure(s.str().c_str(), [&table, n, f]() { Insert(table, n, f); });

Hashtable<string, int> table(f);
s = stringstream();
s << "FindPresent_1e" << j << "_" << i << "/4";
Measure(s.str().c_str(), [&table, n]() { FindPresent(table, n); });

0 comments on commit a2913f1

Please sign in to comment.
You can’t perform that action at this time.