Good job , finally you published something out.
I'd recommend that you run a performance test for example on following code:
https://github.com/pureland/bitshares-2/blob/baaa44d920bd010a5344c164ae61ea76ffff3323/libraries/chain/db_balance.cpp#L44-L56
vector<pair<account_id_type, share_type>> database::get_balance(asset_id_type asset_id) const
{
vector<pair<account_id_type, share_type>> results;
pair<account_id_type, share_type> result;
auto& index = get_index_type<account_balance_index>().indices().get<by_asset>();
for (auto itr = index.find(asset_id); itr != index.end() && itr->asset_type == asset_id; itr++)
{
result.first = itr->owner;
result.second = itr->balance;
results.push_back(result);
}
return results;
}
IMO std::vector will kill performance.
thank you
I would change a way ,
like a multiple transfer , a transfer send to many user
it would take more spare of chain ,but small cpu time
consider account id take 8B, and shares also take 8B, it mean increase a receiver of a transfer , it just increase 16B ,
if a transfer send to 10,000 accounts , it is just increase 160KB apace , it is not too much .
if want to reduce the space more ,
1.2^32 is a big value , and now there are only about 100k account ,so in a multiple transfer ,use 4B to record account_id, and also use the small apace to record shares
2.set two parameters
account_id_length and share_length
to define how many bytes acount_id take and how many bytes shares take , it would reduce to 8B for one receiver increasing in multiple transfer.