.examples

git-svn-id: svn://ultimatepp.org/upp/trunk@9284 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-12-12 12:57:39 +00:00
parent 57b17a5906
commit a54bcae5bf
5 changed files with 10 additions and 30 deletions

View file

@ -12,18 +12,7 @@
#include <map>
#include <deque>
#include <string>
#define TEST_HASHMAP
#ifdef TEST_HASHMAP
#ifdef COMPILER_GCC
#include <tr1/unordered_map>
#else
#include <hash_map>
#endif
#endif
#include <unordered_map>
using namespace std;
using namespace Upp;
@ -126,13 +115,7 @@ void BenchMap(const char *file)
#endif
}
#ifdef TEST_HASHMAP
#ifdef COMPILER_GCC
typedef std::tr1::unordered_map< string, vector<int> > HashMap;
#else
typedef stdext::hash_map< string, vector<int> > HashMap;
#endif
typedef std::unordered_map< string, vector<int> > HashMap;
inline bool h_less(const HashMap::value_type *a, const HashMap::value_type *b)
{
@ -163,9 +146,7 @@ void BenchHashMap(const char *file)
#endif
}
#endif
#define N 100
#define N 10000
CONSOLE_APP_MAIN
{
@ -179,7 +160,6 @@ CONSOLE_APP_MAIN
BenchNTL(fn); // first run to cache the file
#ifdef TEST_HASHMAP
{
BenchHashMap(fn);
TimeStop tm;
@ -187,7 +167,6 @@ CONSOLE_APP_MAIN
BenchHashMap(fn);
cout << "STL hash_map time: " << tm.Elapsed() << " ms \n";
}
#endif
{
BenchMap(fn);