X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=check%2Ftime_hashmap.cpp;h=4ccab563b86420d1e7c55b13d90ba35ddee18670;hb=761d1597532504762c1f9b438c7727c4f74d7da3;hp=5f6a09931c0d0ca1363aba49c6d6c2c477600cff;hpb=da64e515abf7243bc4c84ca3631470931c4e6691;p=ginac.git diff --git a/check/time_hashmap.cpp b/check/time_hashmap.cpp index 5f6a0993..4ccab563 100644 --- a/check/time_hashmap.cpp +++ b/check/time_hashmap.cpp @@ -3,7 +3,7 @@ * Timings for exhashmap<> operations. */ /* - * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2017 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include "ginac.h" +#include "timer.h" +using namespace GiNaC; + +#include +#include +using namespace std; template static void run_timing(unsigned size, double &time_insert, double &time_find, double &time_erase) @@ -67,7 +73,6 @@ unsigned time_hashmap() unsigned result = 0; cout << "timing hash map operations" << flush; - clog << "-------hash map operations:" << endl; unsigned s[] = {10000, 50000, 100000, 500000}; vector sizes(s, s+sizeof(s)/sizeof(*s)); @@ -77,10 +82,10 @@ unsigned time_hashmap() for (vector::const_iterator i = sizes.begin(); i != sizes.end(); ++i) { double time_insert, time_find, time_erase; - run_timing< exhashmap >(*i, time_insert, time_find, time_erase); + run_timing>(*i, time_insert, time_find, time_erase); // If you like, you can compare it with this: -// run_timing< std::map >(*i, time_insert, time_find, time_erase); +// run_timing>(*i, time_insert, time_find, time_erase); times_insert.push_back(time_insert); times_find.push_back(time_find); @@ -88,13 +93,6 @@ unsigned time_hashmap() cout << '.' << flush; } - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } - // print the report: cout << endl << " size:\t"; copy(sizes.begin(), sizes.end(), ostream_iterator(cout, "\t")); @@ -108,3 +106,12 @@ unsigned time_hashmap() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_hashmap(); +}