bitshares / bitshares/bitshares-core
Improve pay_workers() performance
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 660
- Avg merge
- 8h 17m
- Merged PRs (30d)
- 26
Description
- [ ] This code iterates through all worker objects:
https://github.com/bitshares/bitshares-core/blob/06aee789a4e2045d899e02b096d5a1a908be2865/libraries/chain/db_maint.cpp#L120-L125
It can be optimized with a new `by_expiration` index.
This is low priority because we don't have too many workers so far.
- [ ] This code can be replaced with a `by_votes` index, I'm not sure the performance would be better or not though:
https://github.com/bitshares/bitshares-core/blob/06aee789a4e2045d899e02b096d5a1a908be2865/libraries/chain/db_maint.cpp#L127-L135
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in libraries/chain/db_maint.cpp at lines 120-125 and trace the worker object indexes used by pay_workers(). Evaluate adding a by_expiration index so the function avoids iterating through all workers; done means worker payouts retain their behavior while the relevant lookup is more efficient.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- blockchain, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100