<ClInclude Include="..\..\..\tests\cppunit\thread.h" />\r
</ItemGroup>\r
<ItemGroup>\r
- <ClCompile Include="..\..\..\tests\hashing\city.cpp" />\r
+ <ClCompile Include="..\..\..\tests\hashing\city.cpp">\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='ICL-Release|Win32'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='ICL-Debug|Win32'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='ICL-Release|x64'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='ICL-Debug|x64'">Level2</WarningLevel>\r
+ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Level2</WarningLevel>\r
+ </ClCompile>\r
<ClCompile Include="..\..\..\tests\hashing\md5.cpp" />\r
<ClCompile Include="..\..\..\tests\hashing\sha256.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\ellen_bintree_update_desc_pool.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_cuckoo.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_ellentree.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_michael.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_refinable.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_multilevelhashset.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_skip.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_split.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind_std.cpp" />\r
tests/unit/set2/set_insdel_string_striped.cpp \
tests/unit/set2/set_insdel_string_std.cpp \
tests/unit/set2/set_insdelfind.cpp \
- tests/unit/set2/set_insdelfind_michael.cpp \
tests/unit/set2/set_insdelfind_cuckoo.cpp \
tests/unit/set2/set_insdelfind_ellentree.cpp \
- tests/unit/set2/set_insdelfind_refinable.cpp \
+ tests/unit/set2/set_insdelfind_michael.cpp \
+ tests/unit/set2/set_insdelfind_multilevelhashset.cpp \
tests/unit/set2/set_insdelfind_skip.cpp \
tests/unit/set2/set_insdelfind_split.cpp \
tests/unit/set2/set_insdelfind_striped.cpp \
set_insdel_string_striped.cpp
set_insdel_string_std.cpp
set_insdelfind.cpp
- set_insdelfind_michael.cpp
set_insdelfind_cuckoo.cpp
set_insdelfind_ellentree.cpp
- set_insdelfind_refinable.cpp
+ set_insdelfind_michael.cpp
+ set_insdelfind_multilevelhashset.cpp
set_insdelfind_skip.cpp
set_insdelfind_split.cpp
set_insdelfind_striped.cpp
namespace set2 {
CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDelFind );
- size_t Set_InsDelFind::c_nInitialMapSize = 500000;
- size_t Set_InsDelFind::c_nThreadCount = 8;
- size_t Set_InsDelFind::c_nMaxLoadFactor = 8;
- unsigned int Set_InsDelFind::c_nInsertPercentage = 5;
- unsigned int Set_InsDelFind::c_nDeletePercentage = 5;
- unsigned int Set_InsDelFind::c_nDuration = 30;
- bool Set_InsDelFind::c_bPrintGCState = true;
-
void Set_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
{
- c_nInitialMapSize = cfg.getSizeT("InitialMapSize", c_nInitialMapSize );
+ c_nSetSize = cfg.getSizeT("InitialMapSize", c_nSetSize );
c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
c_nDuration = cfg.getUInt("Duration", c_nDuration );
c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
+ c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize );
+ c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize );
+ c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold );
+
if ( c_nThreadCount == 0 )
- c_nThreadCount = cds::OS::topology::processor_count() * 2;
+ c_nThreadCount = std::thread::hardware_concurrency();
CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
std::fill( pFirst, pLast, do_find );
shuffle( m_arrShuffle, pLast );
}
-
- void Set_InsDelFind::myRun(const char *in_name, bool invert /*= false*/)
- {
- setUpParams( m_Cfg.get( "Map_InsDelFind" ));
-
- run_MichaelSet(in_name, invert);
- run_SplitList(in_name, invert);
- run_SkipListSet(in_name, invert);
- run_EllenBinTreeSet(in_name, invert);
- run_StripedSet(in_name, invert);
- run_RefinableSet(in_name, invert);
- run_CuckooSet(in_name, invert);
- run_StdSet(in_name, invert);
-
- endTestCase();
- }
} // namespace set2
namespace set2 {
-# define TEST_SET(IMPL, C, X) void C::X() { test<set_type<IMPL, key_type, value_type>::X >() ; }
-# define TEST_SET_EXTRACT(IMPL, C, X) TEST_SET(IMPL, C, X)
-# define TEST_SET_NOLF(IMPL, C, X) void C::X() { test_nolf<set_type<IMPL, key_type, value_type>::X >() ; }
-# define TEST_SET_NOLF_EXTRACT(IMPL, C, X) TEST_SET_NOLF(IMPL, C, X)
+#define TEST_CASE(TAG, X) void X();
class Set_InsDelFind: public CppUnitMini::TestCase
{
- static size_t c_nInitialMapSize; // initial map size
- static size_t c_nThreadCount; // thread count
- static size_t c_nMaxLoadFactor; // maximum load factor
- static unsigned int c_nInsertPercentage;
- static unsigned int c_nDeletePercentage;
- static unsigned int c_nDuration; // test duration, seconds
- static bool c_bPrintGCState;
+ public:
+ size_t c_nSetSize = 500000; // initial set size
+ size_t c_nThreadCount = 8; // thread count
+ size_t c_nMaxLoadFactor = 8; // maximum load factor
+ unsigned int c_nInsertPercentage = 5;
+ unsigned int c_nDeletePercentage = 5;
+ unsigned int c_nDuration = 30; // test duration, seconds
+ bool c_bPrintGCState = true;
+
+ size_t c_nCuckooInitialSize = 1024;// initial size for CuckooSet
+ size_t c_nCuckooProbesetSize = 16; // CuckooSet probeset size (only for list-based probeset)
+ size_t c_nCuckooProbesetThreshold = 0; // CUckooSet probeset threshold (0 - use default)
+
+ size_t c_nLoadFactor = 2;
public:
enum actions
actions * pAct = getTest().m_arrShuffle;
unsigned int i = 0;
- size_t const nNormalize = size_t(-1) / (c_nInitialMapSize * 2);
+ size_t const nNormalize = size_t(-1) / ( getTest().c_nSetSize * 2);
size_t nRand = 0;
while ( !time_elapsed() ) {
size_t n = nRand / nNormalize;
switch ( pAct[i] ) {
case do_find:
- if ( rMap.find( n ))
+ if ( rMap.contains( n ))
++m_nFindSuccess;
else
++m_nFindFailed;
protected:
template <class Set>
- void do_test( size_t nLoadFactor )
- {
- CPPUNIT_MSG( "Load factor=" << nLoadFactor );
-
- Set testSet( c_nInitialMapSize, nLoadFactor );
- do_test_with( testSet );
- }
-
- template <class Set>
- void do_test_with( Set& testSet )
+ void do_test( Set& testSet )
{
typedef WorkThread<Set> work_thread;
// fill map - only odd number
{
- size_t * pInitArr = new size_t[ c_nInitialMapSize ];
- size_t * pEnd = pInitArr + c_nInitialMapSize;
- for ( size_t i = 0; i < c_nInitialMapSize; ++i )
+ size_t * pInitArr = new size_t[ c_nSetSize ];
+ size_t * pEnd = pInitArr + c_nSetSize;
+ for ( size_t i = 0; i < c_nSetSize; ++i )
pInitArr[i] = i * 2 + 1;
shuffle( pInitArr, pEnd );
for ( size_t * p = pInitArr; p < pEnd; ++p )
}
template <class Set>
- void test()
+ void run_test()
{
CPPUNIT_MSG( "Thread count=" << c_nThreadCount
- << " initial map size=" << c_nInitialMapSize
+ << " initial map size=" << c_nSetSize
<< " insert=" << c_nInsertPercentage << '%'
<< " delete=" << c_nDeletePercentage << '%'
<< " duration=" << c_nDuration << "s"
);
- for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
- do_test<Set>( nLoadFactor );
+ if ( Set::c_bLoadFactorDepended ) {
+ for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) {
+ CPPUNIT_MSG(" LoadFactor = " << c_nLoadFactor );
+ Set s( *this );
+ do_test( s );
+ if ( c_bPrintGCState )
+ print_gc_state();
+ }
+ }
+ else {
+ Set s( *this );
+ do_test( s );
if ( c_bPrintGCState )
print_gc_state();
}
}
- template <class Set>
- void test_nolf()
- {
- CPPUNIT_MSG( "Thread count=" << c_nThreadCount
- << " initial map size=" << c_nInitialMapSize
- << " insert=" << c_nInsertPercentage << '%'
- << " delete=" << c_nDeletePercentage << '%'
- << " duration=" << c_nDuration << "s"
- );
-
- Set s;
- do_test_with( s );
- //CPPUNIT_MSG( s.statistics() );
- if ( c_bPrintGCState )
- print_gc_state();
- }
-
void setUpParams( const CppUnitMini::TestCfg& cfg );
- void run_MichaelSet(const char *in_name, bool invert = false);
- void run_SplitList(const char *in_name, bool invert = false);
- void run_SkipListSet(const char *in_name, bool invert = false);
- void run_CuckooSet(const char *in_name, bool invert = false);
- void run_StripedSet(const char *in_name, bool invert = false);
- void run_RefinableSet(const char *in_name, bool invert = false);
- void run_EllenBinTreeSet(const char *in_name, bool invert = false);
- void run_StdSet(const char *in_name, bool invert = false);
-
- virtual void myRun(const char *in_name, bool invert = false);
-
# include "set2/set_defs.h"
CDSUNIT_DECLARE_MichaelSet
CDSUNIT_DECLARE_SplitList
CDSUNIT_DECLARE_CuckooSet
CDSUNIT_DECLARE_SkipListSet
CDSUNIT_DECLARE_EllenBinTreeSet
+ CDSUNIT_DECLARE_MultiLevelHashSet
CDSUNIT_DECLARE_StdSet
+
+ CPPUNIT_TEST_SUITE_(Set_InsDelFind, "Map_InsDelFind")
+ CDSUNIT_TEST_MichaelSet
+ CDSUNIT_TEST_SplitList
+ CDSUNIT_TEST_SkipListSet
+ CDSUNIT_TEST_MultiLevelHashSet
+ CDSUNIT_TEST_EllenBinTreeSet
+ CDSUNIT_TEST_StripedSet
+ CDSUNIT_TEST_RefinableSet
+ CDSUNIT_TEST_CuckooSet
+ CDSUNIT_TEST_StdSet
+ CPPUNIT_TEST_SUITE_END();
+
};
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_cuckoo.h"
-namespace set2 {
- CDSUNIT_DEFINE_CuckooSet( cc::cuckoo::implementation_tag, Set_InsDelFind )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_CuckooSet )
- CDSUNIT_TEST_CuckooSet
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_CuckooSet
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_ellen_bintree.h"
-namespace set2 {
- CDSUNIT_DEFINE_EllenBinTreeSet( cc::ellen_bintree::implementation_tag, Set_InsDelFind )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_EllenBinTreeSet )
- CDSUNIT_TEST_EllenBinTreeSet
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_EllenBinTreeSet
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_michael.h"
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
namespace set2 {
- CDSUNIT_DEFINE_MichaelSet( cc::michael_set::implementation_tag, Set_InsDelFind )
-
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_MichaelSet )
- CDSUNIT_TEST_MichaelSet
- CPPUNIT_TEST_SUITE_END_PART()
+ CDSUNIT_DECLARE_MichaelSet
} // namespace set2
--- /dev/null
+//$$CDS-header$$
+
+#include "set2/set_insdelfind.h"
+#include "set2/set_type_multilevel_hashset.h"
+
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
+
+namespace set2 {
+ CDSUNIT_DECLARE_MultiLevelHashSet
+} // namespace set2
+++ /dev/null
-//$$CDS-header$$
-
-#include "set2/set_insdelfind.h"
-#include "set2/set_type_striped.h"
-
-namespace set2 {
- CDSUNIT_DEFINE_RefinableSet( cc::striped_set::implementation_tag, Set_InsDelFind )
-
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_RefinableSet )
- CDSUNIT_TEST_RefinableSet
- CPPUNIT_TEST_SUITE_END_PART()
-} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_skip_list.h"
-namespace set2 {
- CDSUNIT_DEFINE_SkipListSet(cc::skip_list::implementation_tag, Set_InsDelFind)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_SkipListSet )
- CDSUNIT_TEST_SkipListSet
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_SkipListSet
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_split_list.h"
-namespace set2 {
- CDSUNIT_DEFINE_SplitList(cc::split_list::implementation_tag, Set_InsDelFind)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_SplitList )
- CDSUNIT_TEST_SplitList
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_SplitList
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_std.h"
-namespace set2 {
- CDSUNIT_DEFINE_StdSet(std_implementation_tag, Set_InsDelFind)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_StdSet )
- CDSUNIT_TEST_StdSet
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_StdSet
} // namespace set2
#include "set2/set_insdelfind.h"
#include "set2/set_type_striped.h"
-namespace set2 {
- CDSUNIT_DEFINE_StripedSet( cc::striped_set::implementation_tag, Set_InsDelFind )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Set_InsDelFind::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
- CPPUNIT_TEST_SUITE_PART( Set_InsDelFind, run_StripedSet )
- CDSUNIT_TEST_StripedSet
- CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+ CDSUNIT_DECLARE_StripedSet
+ CDSUNIT_DECLARE_RefinableSet
} // namespace set2
return base_class::extract( hasher()(key) );
}
+ template <typename Q>
+ bool contains( Q const& key )
+ {
+ return base_class::contains( hasher()(key) );
+ }
+
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
{}
template <typename Key>
- bool find( const Key& key )
+ bool contains( const Key& key )
{
scoped_lock al( m_lock );
return base_class::find( value_type(key) ) != base_class::end();
{}
template <typename Key>
- bool find( const Key& key )
+ bool contains( const Key& key )
{
value_type v( key );
scoped_lock al( m_lock );