bitshares / bitshares/bitshares-core

Improve pay_workers() performance

Open
#1,106 0 comments 0 reactions 0 assignees View on GitHub
4a Low Priority 6 Performance 9b Small 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.