-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve adjust_balance performance #1083
Comments
Updated profiling data after #1085:
After first attempt to optimize, new profile:
Total replay time reduced by
I'll create a new PR after done cleanup. From the profile, we can see that the position of |
Note: asset_api::get_asset_holders(...) and asset_api::get_all_asset_holders() will return unordered results after this change.
This is still needed. Latest data profiling shows more than 10% of CPU time is used to (unnecessarily) sort balances. #1099 attempted to improve it by copying some data to a new "table". A new idea is to use a secondary index and do partial sorting, E.G. store the balances in a binary heap (and this link is useful: updating data in a heap takes |
Will do. Recently I moved my dev env to a new machine, need to get comparable data. In October 2018 when reviewing #1359, I've run profiling on my old machine, to replay 27M blocks,
In my new machine:
|
When replaying the first 27M blocks, current
|
I figured out why current develop branch is slower: default plugins including account_history, grouped_orders and etc are loaded. It seems the "plugins" option specified in config.ini is ignored, also, when generating a new config.ini, there is no longer a "plugins" option inside. I think it's a bug, will submit a new issue. In the meanwhile, I'll run profiling again with "plugins" option as a command line argument. |
When loading only
Percentages are a bit different:
|
Thanks. |
FTR: I have made various attempts to optimize |
AFAICT bitshares-core/libraries/chain/protocol/fee_schedule.cpp Lines 132 to 134 in 319d7b9
bitshares-core/libraries/chain/protocol/operations.cpp Lines 28 to 30 in 319d7b9
bitshares-core/libraries/chain/asset_object.cpp Lines 40 to 44 in 58c0c49
I guess it worth a new issue. (Update: created #1660) |
Replay profiling data:
Note:
account_index::find(object_id_type)
) will be discussed in Improve vote tally performance #803. It's not in scope of this issue.adjust_balance
.Background: in order to implement
top_n_authorities
asset committee mechanism (for STEALTH), we addedby_asset_balance
into indices ofaccount_balance_index
, which impacted overall performance:by_asset_balance
for consensus;top_n_authorities
(e.g. STEALTH), since the asset committee only gets updated in maintenance interval, it's an overkill to maintainby_asset_balance
for consensus.Another use of
by_asset_balance
isasset_api::get_asset_holders
, which can be used to fetch holders of specified asset in descending order. Since it is not related to consensus, in addition,asset_api
is not enabled by default due to potential performance issues (#312 (comment)), I propose we moveby_asset_balance
to a plugin and refactorasset_api
.This is a sub-task of #982.
The text was updated successfully, but these errors were encountered: