---
# System prepended metadata

title: Various timing measurements for Prysm on Altair

---

# Various timing measurements for Prysm on Altair

## Setup
 - mbp16
 - 2.6GHz 6‑core 9th‑generation Intel Core i7
 - 16GB
 - Prysm commit: `45bfd82c8832f2da4803e73a319dfa0b3236f388`

## Definitions
* *process_epoch_process_time*: The time it takes to process [process_epoch](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#epoch-processing)
* *state_transition_process_time*: The time it takes to process [state_transition](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function)
* *on_block_until_update_head_time*: The time it takes to process [on_block](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/fork-choice.md#on_block)
* *update_head_time*: The time it takes to update head and process [get_head](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/fork-choice.md#get_head)

## Results
* *process_epoch_process_time* takes **80ms** to **120ms**
![](https://i.imgur.com/moSbOsV.png)


* *state_transition_process_time* takes **100ms** normal case and **180ms** worst case when process epoch is invovled. It means without epoch processing, `process_block` takes **>100ms**
![](https://i.imgur.com/mYnYwVf.png)

* *on_block_until_update_head_time* takes **150ms** normal case and **350ms** worst case at epoch boundary. The **350ms** here is a good optimizaiton target
![](https://i.imgur.com/4v1Nmir.png)


* *update_head_time* takes **60ms**
![](https://i.imgur.com/fjuzX8j.png)

## Conclusion
- First optimization target is `on_block_until_update_head_time`.
If we compare the worst times between `on_block_until_update_head_time` and `state_transition_process_time`, there's an extra **170ms** that we can shred off.
Example:
```python=
    # Update justified checkpoint
    if state.current_justified_checkpoint.epoch > store.justified_checkpoint.epoch:
        if state.current_justified_checkpoint.epoch > store.best_justified_checkpoint.epoch:
            store.best_justified_checkpoint = state.current_justified_checkpoint
        if should_update_justified_checkpoint(store, state.current_justified_checkpoint):
            store.justified_checkpoint = state.current_justified_checkpoint

    # Update finalized checkpoint
    if state.finalized_checkpoint.epoch > store.finalized_checkpoint.epoch:
        store.finalized_checkpoint = state.finalized_checkpoint

        # Potentially update justified if different from store
        if store.justified_checkpoint != state.current_justified_checkpoint:
            # Update justified if new justified is later than store justified
            if state.current_justified_checkpoint.epoch > store.justified_checkpoint.epoch:
                store.justified_checkpoint = state.current_justified_checkpoint
                return

            # Update justified if store justified is not in chain with finalized checkpoint
            finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
            ancestor_at_finalized_slot = get_ancestor(store, store.justified_checkpoint.root, finalized_slot)
            if ancestor_at_finalized_slot != store.finalized_checkpoint.root:
                store.justified_checkpoint = state.current_justified_checkpoint
```

- Second optimization target is `process_epoch`. The **120ms** 