<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_cuckoo.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_ellentree.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_michael.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_refinable.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_multilevelhashmap.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_skip.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_split.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_std.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_find_int_multilevelhashmap.cpp">\r
<Filter>map_find_int</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_refinable.cpp">\r
- <Filter>map_insfind_int</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\..\..\tests\unit\map2\map_find_string_multilevelhashmap.cpp">\r
<Filter>map_find_string</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_multilevelhashmap.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\tests\unit\map2\map_find_int.h">\r
tests/unit/map2/map_insfind_int_cuckoo.cpp \
tests/unit/map2/map_insfind_int_ellentree.cpp \
tests/unit/map2/map_insfind_int_michael.cpp \
+ tests/unit/map2/map_insfind_int_multilevelhashmap.cpp \
tests/unit/map2/map_insfind_int_skip.cpp \
tests/unit/map2/map_insfind_int_split.cpp \
tests/unit/map2/map_insfind_int_striped.cpp \
- tests/unit/map2/map_insfind_int_refinable.cpp \
tests/unit/map2/map_insfind_int_std.cpp \
tests/unit/map2/map_insdel_func.cpp \
tests/unit/map2/map_insdel_func_bronsonavltree.cpp \
MapSize=1000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+# *** Cuckoo map properties\r
+CuckooInitialSize=256\r
+CuckooProbesetSize=8\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=8\r
+MultiLevelMapArrayBits=4\r
\r
[Map_InsDelFind]\r
InitialMapSize=50000\r
MapSize=1000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+# *** Cuckoo map properties\r
+CuckooInitialSize=1024\r
+CuckooProbesetSize=16\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=8\r
+MultiLevelMapArrayBits=4\r
\r
[Map_InsDelFind]\r
InitialMapSize=500000\r
MapSize=5000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+# *** Cuckoo map properties\r
+CuckooInitialSize=1024\r
+CuckooProbesetSize=16\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=10\r
+MultiLevelMapArrayBits=4\r
\r
[Map_InsDelFind]\r
InitialMapSize=500000\r
map_insfind_int_cuckoo.cpp
map_insfind_int_ellentree.cpp
map_insfind_int_michael.cpp
+ map_insfind_int_multievelhashmap.cpp
map_insfind_int_skip.cpp
map_insfind_int_split.cpp
map_insfind_int_striped.cpp
- map_insfind_int_refinable.cpp
map_insfind_int_std.cpp
map_insdel_func.cpp
map_insdel_func_bronsonavltree.cpp
void run_test()
{
if ( Map::c_bLoadFactorDepended ) {
- for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
- CPPUNIT_MSG( "Load factor=" << nLoadFactor );
+ for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) {
+ CPPUNIT_MSG( "Load factor=" << c_nLoadFactor );
Map testMap( *this );
find_string_test( testMap );
if ( c_bPrintGCState )
namespace map2 {
CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsFind_int );
- size_t Map_InsFind_int::c_nMapSize = 1000000 ; // map size
- size_t Map_InsFind_int::c_nThreadCount = 4 ; // count of insertion thread
- size_t Map_InsFind_int::c_nMaxLoadFactor = 8 ; // maximum load factor
- bool Map_InsFind_int::c_bPrintGCState = true;
-
void Map_InsFind_int::setUpParams( const CppUnitMini::TestCfg& cfg )
{
- c_nThreadCount = cfg.getULong("ThreadCount", 0 );
- c_nMapSize = cfg.getULong("MapSize", static_cast<unsigned long>(c_nMapSize));
- c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", static_cast<unsigned long>(c_nMaxLoadFactor));
- c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
- if ( c_nThreadCount == 0 )
- c_nThreadCount = cds::OS::topology::processor_count();
- }
+ c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
+ c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize);
+ c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor);
+ c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
- void Map_InsFind_int::myRun(const char *in_name, bool invert /*= false*/)
- {
- setUpParams( m_Cfg.get( "Map_InsFind_int" ));
+ c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize);
+ c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize);
+ c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold);
- run_MichaelMap(in_name, invert);
- run_SplitList(in_name, invert);
- run_SkipListMap(in_name, invert);
- run_EllenBinTreeMap(in_name, invert);
- run_BronsonAVLTreeMap(in_name, invert);
- run_StripedMap(in_name, invert);
- run_RefinableMap(in_name, invert);
- run_CuckooMap(in_name, invert);
- run_StdMap(in_name, invert);
+ c_nMultiLevelMap_HeadBits = cfg.getSizeT("MultiLevelMapHeadBits", c_nMultiLevelMap_HeadBits);
+ c_nMultiLevelMap_ArrayBits = cfg.getSizeT("MultiLevelMapArrayBits", c_nMultiLevelMap_ArrayBits);
- endTestCase();
+ if ( c_nThreadCount == 0 )
+ c_nThreadCount = std::thread::hardware_concurrency();
}
-
- /*
- CPPUNIT_TEST_SUITE( Map_InsFind_int )
- CDSUNIT_TEST_MichaelMap
- CDSUNIT_TEST_MichaelMap_nogc
- CDSUNIT_TEST_SplitList
- CDSUNIT_TEST_SplitList_nogc
- CDSUNIT_TEST_SkipListMap
- CDSUNIT_TEST_SkipListMap_nogc
- CDSUNIT_TEST_EllenBinTreeMap
- CDSUNIT_TEST_BronsonAVLTreeMap
- CDSUNIT_TEST_StripedMap
- CDSUNIT_TEST_RefinableMap
- CDSUNIT_TEST_CuckooMap
- CDSUNIT_TEST_StdMap
- CPPUNIT_TEST_SUITE_END()
- */
} // namespace map2
namespace map2 {
-# define TEST_MAP(IMPL, C, X) void C::X() { test<map_type<IMPL, key_type, value_type>::X >(); }
-# define TEST_MAP_NOLF(IMPL, C, X) void C::X() { test_nolf<map_type<IMPL, key_type, value_type>::X >(); }
-# define TEST_MAP_EXTRACT(IMPL, C, X) TEST_MAP(IMPL, C, X)
-# define TEST_MAP_NOLF_EXTRACT(IMPL, C, X) TEST_MAP_NOLF(IMPL, C, X)
+#define TEST_CASE(TAG, X) void X();
class Map_InsFind_int: public CppUnitMini::TestCase
{
- static size_t c_nMapSize; // map size
- static size_t c_nThreadCount; // count of insertion thread
- static size_t c_nMaxLoadFactor; // maximum load factor
- static bool c_bPrintGCState;
+ public:
+ size_t c_nThreadCount = 8; // thread count
+ size_t c_nMapSize = 5000; // map size (count of searching item)
+ size_t c_nMaxLoadFactor = 8; // maximum load factor
+ bool c_bPrintGCState = true;
+ size_t c_nCuckooInitialSize = 1024;// initial size for CuckooMap
+ size_t c_nCuckooProbesetSize = 16; // CuckooMap probeset size (only for list-based probeset)
+ size_t c_nCuckooProbesetThreshold = 0; // CUckooMap probeset threshold (o - use default)
+
+ size_t c_nMultiLevelMap_HeadBits = 10;
+ size_t c_nMultiLevelMap_ArrayBits = 4;
+
+ size_t c_nLoadFactor = 2; // current load factor
+
+ private:
typedef CppUnitMini::TestCase Base;
typedef size_t key_type;
typedef size_t value_type;
void make_array()
{
- size_t const nSize = c_nMapSize / c_nThreadCount + 1;
+ size_t const nThreadCount = getTest().c_nThreadCount;
+ size_t const nSize = getTest().c_nMapSize / nThreadCount + 1;
m_arrVal.resize( nSize );
size_t nItem = m_nThreadNo;
- for ( size_t i = 0; i < nSize; nItem += c_nThreadCount, ++i )
+ for ( size_t i = 0; i < nSize; nItem += nThreadCount, ++i )
m_arrVal[i] = nItem;
shuffle( m_arrVal.begin(), m_arrVal.end() );
}
++m_nInsertFailed;
for ( size_t k = 0; k <= i; ++k ) {
- if ( check_result( rMap.find( m_arrVal[k] ), rMap ))
+ if ( check_result( rMap.contains( m_arrVal[k] ), rMap ))
++m_nFindSuccess;
else
++m_nFindFail;
}
template <class Map>
- void test()
+ void run_test()
{
static_assert( (!std::is_same< typename Map::item_counter, cds::atomicity::empty_item_counter >::value),
"Empty item counter is not suitable for this test");
<< " map size=" << c_nMapSize
);
- for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
- CPPUNIT_MSG( "Load factor=" << nLoadFactor );
- Map testMap( c_nMapSize, nLoadFactor );
+ if ( Map::c_bLoadFactorDepended ) {
+ for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) {
+ CPPUNIT_MSG( "Load factor=" << c_nLoadFactor );
+ Map testMap( *this );
+ do_test( testMap );
+ if ( c_bPrintGCState )
+ print_gc_state();
+ }
+ }
+ else {
+ Map testMap( *this );
do_test( testMap );
if ( c_bPrintGCState )
print_gc_state();
}
}
- template <class Map>
- void test_nolf()
- {
- static_assert( (!std::is_same< typename Map::item_counter, cds::atomicity::empty_item_counter >::value),
- "Empty item counter is not suitable for this test");
-
- CPPUNIT_MSG( "Thread count: " << c_nThreadCount
- << " map size=" << c_nMapSize
- );
-
- Map testMap;
- do_test( testMap );
- if ( c_bPrintGCState )
- print_gc_state();
- }
-
void setUpParams( const CppUnitMini::TestCfg& cfg );
- void run_MichaelMap(const char *in_name, bool invert = false);
- void run_SplitList(const char *in_name, bool invert = false);
- void run_StripedMap(const char *in_name, bool invert = false);
- void run_RefinableMap(const char *in_name, bool invert = false);
- void run_CuckooMap(const char *in_name, bool invert = false);
- void run_SkipListMap(const char *in_name, bool invert = false);
- void run_EllenBinTreeMap(const char *in_name, bool invert = false);
- void run_BronsonAVLTreeMap(const char *in_name, bool invert = false);
- void run_StdMap(const char *in_name, bool invert = false);
-
- virtual void myRun(const char *in_name, bool invert = false);
-
# include "map2/map_defs.h"
CDSUNIT_DECLARE_MichaelMap
CDSUNIT_DECLARE_MichaelMap_nogc
CDSUNIT_DECLARE_SkipListMap_nogc
CDSUNIT_DECLARE_EllenBinTreeMap
CDSUNIT_DECLARE_BronsonAVLTreeMap
+ CDSUNIT_DECLARE_MultiLevelHashMap
CDSUNIT_DECLARE_StripedMap
CDSUNIT_DECLARE_RefinableMap
CDSUNIT_DECLARE_CuckooMap
CDSUNIT_DECLARE_StdMap
+ CDSUNIT_DECLARE_StdMap_NoLock
+
+ CPPUNIT_TEST_SUITE(Map_InsFind_int)
+ CDSUNIT_TEST_MichaelMap
+ CDSUNIT_TEST_MichaelMap_nogc
+ CDSUNIT_TEST_SplitList
+ CDSUNIT_TEST_SplitList_nogc
+ CDSUNIT_TEST_SkipListMap
+ CDSUNIT_TEST_SkipListMap_nogc
+ CDSUNIT_TEST_EllenBinTreeMap
+ CDSUNIT_TEST_BronsonAVLTreeMap
+ CDSUNIT_TEST_MultiLevelHashMap
+ CDSUNIT_TEST_CuckooMap
+ CDSUNIT_TEST_StripedMap
+ CDSUNIT_TEST_RefinableMap
+ CDSUNIT_TEST_StdMap
+ CDSUNIT_TEST_StdMap_NoLock
+ CPPUNIT_TEST_SUITE_END();
};
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_bronson_avltree.h"
-namespace map2 {
- CDSUNIT_DEFINE_BronsonAVLTreeMap( cc::bronson_avltree::implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_BronsonAVLTreeMap )
- CDSUNIT_TEST_BronsonAVLTreeMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_BronsonAVLTreeMap
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_cuckoo.h"
-namespace map2 {
- CDSUNIT_DEFINE_CuckooMap(cds::intrusive::cuckoo::implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_CuckooMap )
- CDSUNIT_TEST_CuckooMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_CuckooMap
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_ellen_bintree.h"
-namespace map2 {
- CDSUNIT_DEFINE_EllenBinTreeMap( cc::ellen_bintree::implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_EllenBinTreeMap )
- CDSUNIT_TEST_EllenBinTreeMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_EllenBinTreeMap
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_michael.h"
-namespace map2 {
- CDSUNIT_DEFINE_MichaelMap( cc::michael_map::implementation_tag, Map_InsFind_int )
- CDSUNIT_DEFINE_MichaelMap_nogc( cc::michael_map::implementation_tag, Map_InsFind_int )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_MichaelMap )
- CDSUNIT_TEST_MichaelMap
- CDSUNIT_TEST_MichaelMap_nogc
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_MichaelMap
+ CDSUNIT_DECLARE_MichaelMap_nogc
} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insfind_int.h"
+#include "map2/map_type_multilevel_hashmap.h"
+
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
+
+namespace map2 {
+ CDSUNIT_DECLARE_MultiLevelHashMap
+} // namespace map2
+++ /dev/null
-//$$CDS-header$$
-
-#include "map2/map_insfind_int.h"
-#include "map2/map_type_striped.h"
-
-namespace map2 {
- CDSUNIT_DEFINE_RefinableMap(cc::striped_set::implementation_tag, Map_InsFind_int)
-
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_RefinableMap )
- CDSUNIT_TEST_RefinableMap
- CPPUNIT_TEST_SUITE_END_PART()
-} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_skip_list.h"
-namespace map2 {
- CDSUNIT_DEFINE_SkipListMap( cc::skip_list::implementation_tag, Map_InsFind_int)
- CDSUNIT_DEFINE_SkipListMap_nogc( cc::skip_list::implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_SkipListMap )
- CDSUNIT_TEST_SkipListMap
- CDSUNIT_TEST_SkipListMap_nogc
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_SkipListMap
+ CDSUNIT_DECLARE_SkipListMap_nogc
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_split_list.h"
-namespace map2 {
- CDSUNIT_DEFINE_SplitList( cc::split_list::implementation_tag, Map_InsFind_int )
- CDSUNIT_DEFINE_SplitList_nogc( cc::split_list::implementation_tag, Map_InsFind_int )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_SplitList )
- CDSUNIT_TEST_SplitList
- CDSUNIT_TEST_SplitList_nogc
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_SplitList
+ CDSUNIT_DECLARE_SplitList_nogc
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_std.h"
-namespace map2 {
- CDSUNIT_DEFINE_StdMap( map2::std_implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_StdMap )
- CDSUNIT_TEST_StdMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_StdMap
+ CDSUNIT_DECLARE_StdMap_NoLock
} // namespace map2
#include "map2/map_insfind_int.h"
#include "map2/map_type_striped.h"
-namespace map2 {
- CDSUNIT_DEFINE_StripedMap(cc::striped_set::implementation_tag, Map_InsFind_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsFind_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsFind_int, run_StripedMap )
- CDSUNIT_TEST_StripedMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_StripedMap
+ CDSUNIT_DECLARE_RefinableMap
} // namespace map2