[Assorted-commits] SF.net SVN: assorted: [395] hash-join/trunk/src/hashjoin.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-12 21:58:47
|
Revision: 395 http://assorted.svn.sourceforge.net/assorted/?rev=395&view=rev Author: yangzhang Date: 2008-02-12 13:58:51 -0800 (Tue, 12 Feb 2008) Log Message: ----------- tweaks Modified Paths: -------------- hash-join/trunk/src/hashjoin.cc Modified: hash-join/trunk/src/hashjoin.cc =================================================================== --- hash-join/trunk/src/hashjoin.cc 2008-02-12 19:16:18 UTC (rev 394) +++ hash-join/trunk/src/hashjoin.cc 2008-02-12 21:58:51 UTC (rev 395) @@ -1,3 +1,7 @@ +// +// Hash Join +// + #include <memory> #include <cassert> #include <cstdio> @@ -23,10 +27,6 @@ // TODO: #include <boost/array.hpp> -// -// Hash Join -// - using namespace std; using namespace __gnu_cxx; using namespace commons; @@ -46,14 +46,15 @@ void resize(size_type hint) { - cout << "resizing " << this << " to " << hint << endl; + // cout << "resizing " << this << " to " << hint << endl; my_hash_map::resize(hint); } }; // TODO use dependency injection! unsigned int ncpus = 1; -const hmap::size_type map_size = 10000000; +const hmap::size_type map_size = 1000000; +const int min_bucket_size = 1000000; /** * Buckets are produced in the hash-partitioning phase. These are simple @@ -224,7 +225,7 @@ buckets[i] = new bucket[ncpus]; for (unsigned int j = 0; j < ncpus; j++) { // TODO dependency injection - size_t bucket_size = max((size_t) 1000000,buflen / ncpus * 3); + size_t bucket_size = max((size_t) min_bucket_size,buflen / ncpus * 3); // Each bucket should be twice as large as it would be given uniform // distribution. This is just an initial size; extending can happen. buckets[i][j].bufs.push_back(new char[bucket_size]); @@ -260,7 +261,7 @@ { size_t h = hash_djb2(s); unsigned int bucket = h % ncpus; - size_t bucket_size = max((size_t) 1000000, buflen * 3 / ncpus); + size_t bucket_size = max((size_t) min_bucket_size, buflen * 3 / ncpus); if (heads[bucket] + nbytes < bs[bucket].bufs.back() + bucket_size) { memcpy(heads[bucket], p, nbytes); heads[bucket] += nbytes; @@ -470,7 +471,7 @@ } } } - cout << "cpu " << pid << " hits " << hits << " misses " << misses << endl; + // cout << "cpu " << pid << " hits " << hits << " misses " << misses << endl; } // vim:et:sw=2:ts=2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |