Skip to content

Commit fded734

Browse files
author
ABW
committed
decrease size of pool allocators used by singletons/multitons
Full replay test showed there is no point in fine tuning pool allocator block size to the upside, because we can reduce number of block allocations/releases from thousands to tens, which gives no measurable performance benefit, but for the price of higher overhead and much higher initial allocation.
1 parent 6bc4cf1 commit fded734

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

libraries/chain/include/hive/chain/block_summary_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace hive { namespace chain {
2929
ordered_unique< tag< by_id >,
3030
const_mem_fun< block_summary_object, block_summary_object::id_type, &block_summary_object::get_id > >
3131
>,
32-
multi_index_allocator< block_summary_object >
32+
multi_index_allocator< block_summary_object > // multiton (exactly 64k objects plus one internal)
3333
> block_summary_index;
3434

3535
} } // hive::chain

libraries/chain/include/hive/chain/global_property_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ namespace hive { namespace chain {
179179
ordered_unique< tag< by_id >,
180180
const_mem_fun< dynamic_global_property_object, dynamic_global_property_object::id_type, &dynamic_global_property_object::get_id > >
181181
>,
182-
allocator< dynamic_global_property_object >
182+
multi_index_allocator< dynamic_global_property_object, 2 > // singleton (plus one internal)
183183
> dynamic_global_property_index;
184184

185185
} } // hive::chain

libraries/chain/include/hive/chain/hardfork_property_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace hive { namespace chain {
5252
ordered_unique< tag< by_id >,
5353
const_mem_fun< hardfork_property_object, hardfork_property_object::id_type, &hardfork_property_object::get_id > >
5454
>,
55-
multi_index_allocator< hardfork_property_object >
55+
multi_index_allocator< hardfork_property_object, 2 > // singleton (plus one internal)
5656
> hardfork_property_index;
5757

5858
} } // hive::chain

libraries/chain/include/hive/chain/hive_objects.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ namespace hive { namespace chain {
506506
composite_key_compare< std::greater< fc::uint128 >, std::less< account_id_type > >
507507
>
508508
>,
509-
multi_index_allocator< liquidity_reward_balance_object >
509+
multi_index_allocator< liquidity_reward_balance_object, 1024 > // not used after HF12
510510
> liquidity_reward_balance_index;
511511

512512
typedef multi_index_container<
@@ -515,7 +515,7 @@ namespace hive { namespace chain {
515515
ordered_unique< tag< by_id >,
516516
const_mem_fun< feed_history_object, feed_history_object::id_type, &feed_history_object::get_id > >
517517
>,
518-
multi_index_allocator< feed_history_object >
518+
multi_index_allocator< feed_history_object, 2 > // singleton (plus one internal)
519519
> feed_history_index;
520520

521521
struct by_withdraw_route;
@@ -628,7 +628,7 @@ namespace hive { namespace chain {
628628
ordered_unique< tag< by_name >,
629629
member< reward_fund_object, reward_fund_name_type, &reward_fund_object::name > >
630630
>,
631-
multi_index_allocator< reward_fund_object >
631+
multi_index_allocator< reward_fund_object, 2 > // singleton (plus one internal)
632632
> reward_fund_index;
633633

634634
struct by_from_to_id;

libraries/chain/include/hive/chain/rc/rc_objects.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ typedef multi_index_container<
261261
ordered_unique< tag< by_id >,
262262
const_mem_fun< rc_resource_param_object, rc_resource_param_object::id_type, &rc_resource_param_object::get_id > >
263263
>,
264-
multi_index_allocator< rc_resource_param_object >
264+
multi_index_allocator< rc_resource_param_object, 2 > // singleton (plus one internal)
265265
> rc_resource_param_index;
266266

267267
typedef multi_index_container<
@@ -270,7 +270,7 @@ typedef multi_index_container<
270270
ordered_unique< tag< by_id >,
271271
const_mem_fun< rc_pool_object, rc_pool_object::id_type, &rc_pool_object::get_id > >
272272
>,
273-
multi_index_allocator< rc_pool_object >
273+
multi_index_allocator< rc_pool_object, 2 > // singleton (plus one internal)
274274
> rc_pool_index;
275275

276276
typedef multi_index_container<
@@ -279,7 +279,7 @@ typedef multi_index_container<
279279
ordered_unique< tag< by_id >,
280280
const_mem_fun< rc_stats_object, rc_stats_object::id_type, &rc_stats_object::get_id > >
281281
>,
282-
multi_index_allocator< rc_stats_object >
282+
multi_index_allocator< rc_stats_object, 4 > // dubleton (plus one internal)
283283
> rc_stats_index;
284284

285285
struct by_from_to;
@@ -320,7 +320,7 @@ typedef multi_index_container<
320320
ordered_unique< tag< by_timestamp >,
321321
const_mem_fun< rc_usage_bucket_object, time_point_sec, &rc_usage_bucket_object::get_timestamp > >
322322
>,
323-
multi_index_allocator< rc_usage_bucket_object >
323+
multi_index_allocator< rc_usage_bucket_object, 32 > // multiton (always 24 plus one internal)
324324
> rc_usage_bucket_index;
325325

326326
} } // hive::chain

libraries/chain/include/hive/chain/witness_objects.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ namespace hive { namespace chain {
308308
ordered_unique< tag< by_id >,
309309
const_mem_fun< witness_schedule_object, witness_schedule_object::id_type, &witness_schedule_object::get_id > >
310310
>,
311-
multi_index_allocator< witness_schedule_object >
311+
multi_index_allocator< witness_schedule_object, 4 > // dubleton (plus one internal)
312312
> witness_schedule_index;
313313

314314
} }

0 commit comments

Comments
 (0)