Skip to content

Commit

Permalink
program-runtime: double program cache size (#3481)
Browse files Browse the repository at this point in the history
The cache is currently getting thrashed and programs are getting
reloaded pretty much at every single slot. Double the cache size, which
makes reloading happen only due to random eviction sometimes picking a
popular entry.

The JIT code size with the new cache size is about 800MB.

This change reduces jit time 15x.

(cherry picked from commit fb4adda)
  • Loading branch information
alessandrod authored and mergify[bot] committed Nov 6, 2024
1 parent 6f2b6f2 commit f96dfcd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use {
};

pub type ProgramRuntimeEnvironment = Arc<BuiltinProgram<InvokeContext<'static>>>;
pub const MAX_LOADED_ENTRY_COUNT: usize = 256;
pub const MAX_LOADED_ENTRY_COUNT: usize = 512;
pub const DELAY_VISIBILITY_SLOT_OFFSET: Slot = 1;

/// Relationship between two fork IDs
Expand Down Expand Up @@ -1635,7 +1635,7 @@ mod tests {
assert_eq!(num_tombstones, num_tombstones_expected);

// Evict entries from the cache
let eviction_pct = 2;
let eviction_pct = 1;

let num_loaded_expected =
Percentage::from(eviction_pct).apply_to(crate::loaded_programs::MAX_LOADED_ENTRY_COUNT);
Expand Down Expand Up @@ -1718,7 +1718,7 @@ mod tests {
assert_eq!(num_tombstones, num_tombstones_expected);

// Evict entries from the cache
let eviction_pct = 2;
let eviction_pct = 1;

let num_loaded_expected =
Percentage::from(eviction_pct).apply_to(crate::loaded_programs::MAX_LOADED_ENTRY_COUNT);
Expand Down

0 comments on commit f96dfcd

Please sign in to comment.