Skip to content

Commit

Permalink
Memoize program cache write lock
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Apr 26, 2024
1 parent d50c11c commit cce3075
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4156,18 +4156,23 @@ impl Bank {

let mut store_executors_which_were_deployed_time =
Measure::start("store_executors_which_were_deployed_time");
let mut cache = None;
for execution_result in &execution_results {
if let TransactionExecutionResult::Executed {
details,
programs_modified_by_tx,
} = execution_result
{
if details.status.is_ok() && !programs_modified_by_tx.is_empty() {
let mut cache = self.transaction_processor.program_cache.write().unwrap();
cache.merge(programs_modified_by_tx);
cache
.get_or_insert_with(|| {
self.transaction_processor.program_cache.write().unwrap()
})
.merge(programs_modified_by_tx);
}
}
}
drop(cache);
store_executors_which_were_deployed_time.stop();
saturating_add_assign!(
timings.execute_accessories.update_executors_us,
Expand Down

0 comments on commit cce3075

Please sign in to comment.