Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions runtime/benches/status_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use {
rand::{rngs::SmallRng, Rng, SeedableRng},
solana_accounts_db::ancestors::Ancestors,
solana_hash::{Hash, HASH_BYTES},
solana_runtime::{
bank::BankStatusCache, snapshot_bank_utils::serialize_status_cache, status_cache::*,
},
solana_runtime::{bank::BankStatusCache, status_cache::*},
solana_sha256_hasher::hash,
solana_signature::{Signature, SIGNATURE_BYTES},
test::Bencher,
Expand Down Expand Up @@ -46,9 +44,8 @@ fn bench_status_cache_serialize_max(bencher: &mut Bencher) {
fill_status_cache(&mut status_cache, max_cache_entries, 100_000);

assert!(status_cache.roots().contains(&0));
let path = tempfile::NamedTempFile::new().unwrap().into_temp_path();
bencher.iter(|| {
let _ = serialize_status_cache(&status_cache.root_slot_deltas(), &path).unwrap();
let _ = serialize(&status_cache.root_slot_deltas()).unwrap();
Copy link
Copy Markdown
Author

@brooksprumo brooksprumo Aug 20, 2025

Choose a reason for hiding this comment

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

This was added in #7593 to cleanup some tasks from #7559. One was adding this bench. This bench is calling serialize_status_cache() (the fn I'm moving in this PR to a new module), and I realized it is writing to a file.

Microbenchmarks are notoriously finicky, and ones that hit disk are even more so. I've moved this one back to using the stock serialize method here (just like the other status cache bench above, bench_status_cache_serialize()). This also saves us from having to conditionally make serialize_status_cache() public beyond just the crate.

We have metrics for the actual runtime of serialize_status_cache(), and I feel that is sufficient for our needs here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok no worries, that's fine. Just be aware that bincode::serialize on the status cache isn't really what's being run in snapshots with the current code -- we're converting to the serde types and then calling bincode::serialize on those.

});
}

Expand Down
6 changes: 5 additions & 1 deletion runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ use {
types::SerdeAccountsLtHash,
};

mod status_cache;
mod storage;
mod tests;
mod types;
mod utils;

pub(crate) use storage::{SerializableAccountStorageEntry, SerializedAccountsFileId};
pub(crate) use {
status_cache::{deserialize_status_cache, serialize_status_cache},
storage::{SerializableAccountStorageEntry, SerializedAccountsFileId},
};

const MAX_STREAM_SIZE: u64 = 32 * 1024 * 1024 * 1024;

Expand Down
Loading
Loading