# how to speed up solana replay by 100ms and more
Current Solana version has a bug that causes the slot replay (part of TVU) to be slower than needed.
Bug was reported to SolanaLabs https://github.com/solana-labs/solana/issues/27729 with a simple fix https://github.com/solana-labs/solana/pull/27786#issuecomment-1247369996
SolanaLabs accepted the bug but would like to solve it in a different way https://github.com/solana-labs/solana/pull/28069#issuecomment-1282109862 that would take much longer time to be included in the official version.
Until this is done, you can deploy a fix yourself. You would need to build solana from source file (follow instructions here https://github.com/solana-labs/solana)
Before you build the binaries you would need to patch solana source code
### create a patch file
create a file named speedup.patch. Place the file in the main solana project directory. File should. have the below content:
```
diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs
index 0ae45cea3f..095b8aac99 100644
--- a/ledger/src/blockstore.rs
+++ b/ledger/src/blockstore.rs
@@ -4137,16 +4137,13 @@ fn is_newly_completed_slot(slot_meta: &SlotMeta, backup_slot_meta: &Option<SlotM
fn slot_has_updates(slot_meta: &SlotMeta, slot_meta_backup: &Option<SlotMeta>) -> bool {
// We should signal that there are updates if we extended the chain of consecutive blocks starting
// from block 0, which is true iff:
- // 1) The block with index prev_block_index is itself part of the trunk of consecutive blocks
- // starting from block 0,
- slot_meta.is_connected &&
- // AND either:
- // 1) The slot didn't exist in the database before, and now we have a consecutive
- // block for that slot
- ((slot_meta_backup.is_none() && slot_meta.consumed != 0) ||
+ // either:
+ // 1) The slot didn't exist in the database before, and now we have a consecutive
+ // block for that slot
+ (slot_meta_backup.is_none() && slot_meta.consumed != 0) ||
// OR
// 2) The slot did exist, but now we have a new consecutive block for that slot
- (slot_meta_backup.is_some() && slot_meta_backup.as_ref().unwrap().consumed != slot_meta.consumed))
+ (slot_meta_backup.is_some() && slot_meta_backup.as_ref().unwrap().consumed != slot_meta.consumed)
}
// Creates a new ledger with slot 0 full of ticks (and only ticks).
```
### apply the patch
Apply the patch in the main solana project directory:
```
git apply speedup.patch
```
### build and deploy
continue the source installation process by using
```
cargo build --release
```
and deploy. Make sure you are using the solana binary from ./target/release