Skip to content
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

Implement get_provisioners optimisation of the stake contract #1447

Closed
miloszm opened this issue Feb 21, 2024 · 3 comments
Closed

Implement get_provisioners optimisation of the stake contract #1447

miloszm opened this issue Feb 21, 2024 · 3 comments
Assignees
Labels
module:contracts Issues related to the genesis contracts

Comments

@miloszm
Copy link
Contributor

miloszm commented Feb 21, 2024

Summary

Current stake contract's method get_provisioners is a performance bottleneck, as its processing time grows linearly with the number of provisioners. According to measurements, the following data illustrates the problem:

number of provisioners: processing time:
60......................................228.988ms
600....................................2.300383s
1000...................................3.648217s
10000.................................33.811937s

get provisioners becomes a performance bottleneck and needs to be improved

Possible solution design or implementation

Easy optimisation brings significant improvements. We should keep PublicKey in our data structure rather than convert the bytes stored into a PublicKey every time get_provisioners is called. Such change gives the following results:

number of provisioners: processing time:
1000..................................0.002s
10000................................0.012s

Additional context

Since the change is in the stake contract, we need to plan for migration of the stake contract in order to enforce the above optimisation.

@autholykos
Copy link
Member

The consensus needs to consume events from the Stake contract in order to make efficient use of the Provisioner information

@autholykos
Copy link
Member

Blocked by #1448

@HDauven HDauven added module:contracts Issues related to the genesis contracts and removed module:stake-contract labels Apr 8, 2024
@HDauven
Copy link
Member

HDauven commented Apr 8, 2024

Resolved by #1459

@HDauven HDauven closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:contracts Issues related to the genesis contracts
Projects
None yet
Development

No branches or pull requests

3 participants