Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Perf: Store deserialized sysvars in the sysvars cache#22455

Merged
mergify[bot] merged 2 commits intosolana-labs:masterfrom
jstarry:perf/sysvar-cache
Jan 13, 2022
Merged

Perf: Store deserialized sysvars in the sysvars cache#22455
mergify[bot] merged 2 commits intosolana-labs:masterfrom
jstarry:perf/sysvar-cache

Conversation

@jstarry
Copy link
Copy Markdown
Contributor

@jstarry jstarry commented Jan 12, 2022

Problem

Deserializing sysvars is slow

Summary of Changes

  • Store deserialized sysvars in the cache

Fixes #

@jstarry jstarry force-pushed the perf/sysvar-cache branch 2 times, most recently from f66c52e to 98135f5 Compare January 12, 2022 11:20
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 12, 2022

Codecov Report

Merging #22455 (bc4744f) into master (f2908ed) will increase coverage by 0.0%.
The diff coverage is 89.8%.

@@           Coverage Diff            @@
##           master   #22455    +/-   ##
========================================
  Coverage    81.1%    81.1%            
========================================
  Files         555      555            
  Lines      150561   150664   +103     
========================================
+ Hits       122183   122324   +141     
+ Misses      28378    28340    -38     

@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Jan 12, 2022

@behzadnouri I opted not to use your commit and chose to only cache the sysvars which need to be requested from the invoke context. I think this approach is simpler, let me know what you think, thanks!

Comment thread runtime/src/bank.rs Outdated
Comment thread runtime/src/bank/sysvar_cache.rs
@jackcmay
Copy link
Copy Markdown
Contributor

Looking good, have you benched the differences?

@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Jan 13, 2022

Looking good, have you benched the differences?

working on it

@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Jan 13, 2022

Added a bench.. seeing a 25% perf improvement for end to end vote processing (including sigverify, account loading, etc)

BEFORE
test bench_bank_sync_process_vote_transactions           ... bench:  62,237,616 ns/iter (+/- 1,923,483)

AFTER
test bench_bank_sync_process_vote_transactions           ... bench:  47,840,116 ns/iter (+/- 1,726,040)

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Jan 13, 2022
@mergify mergify Bot merged commit 2370e61 into solana-labs:master Jan 13, 2022
mergify Bot pushed a commit that referenced this pull request Jan 13, 2022
* Perf: Store deserialized sysvars in sysvars cache

* add bench

(cherry picked from commit 2370e61)

# Conflicts:
#	program-runtime/src/invoke_context.rs
#	program-runtime/src/sysvar_cache.rs
#	program-test/src/lib.rs
#	programs/address-lookup-table/src/processor.rs
#	programs/bpf_loader/src/syscalls.rs
#	programs/stake/src/stake_instruction.rs
#	programs/vote/src/vote_instruction.rs
#	programs/vote/src/vote_state/mod.rs
#	runtime/benches/bank.rs
#	runtime/src/bank.rs
#	runtime/src/bank/sysvar_cache.rs
mergify Bot pushed a commit that referenced this pull request Jan 13, 2022
* Perf: Store deserialized sysvars in sysvars cache

* add bench

(cherry picked from commit 2370e61)

# Conflicts:
#	program-runtime/src/invoke_context.rs
#	program-runtime/src/sysvar_cache.rs
#	programs/bpf_loader/src/syscalls.rs
#	programs/stake/src/stake_instruction.rs
#	programs/vote/src/vote_instruction.rs
#	runtime/src/bank.rs
#	runtime/src/bank/sysvar_cache.rs
@jstarry jstarry deleted the perf/sysvar-cache branch January 13, 2022 05:47
jstarry added a commit that referenced this pull request Jan 15, 2022
* Perf: Store deserialized sysvars in sysvars cache

* add bench
mergify Bot added a commit that referenced this pull request Jan 15, 2022
… (#22480)

* Perf: Store deserialized sysvars in the sysvars cache (#22455)

* Perf: Store deserialized sysvars in sysvars cache

* add bench

* resolve conflicts

Co-authored-by: Justin Starry <justin@solana.com>
jstarry added a commit to jstarry/solana that referenced this pull request Jan 21, 2022
jstarry added a commit to jstarry/solana that referenced this pull request Jan 22, 2022
jstarry added a commit that referenced this pull request Jan 22, 2022
… (#22627)

* Perf: Store deserialized sysvars in the sysvars cache (#22455)

* resolve conflicts

* remove bench
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2022

This PR has been automatically locked since there has not been any activity in past 14 days after it was merged.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 1, 2022
Comment thread runtime/src/bank.rs
)
});

new.fill_missing_sysvar_cache_entries();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a new invocation to cover this new code-path (ref: https://github.com/solana-labs/solana/pull/30158/files#r1098222823 #30158)

@mergify mergify Bot removed the automerge Merge this Pull Request automatically once CI passes label Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants