Commit Graph

1 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 7138defc6e Make all VmMetrics for the reducers and views of a module in InstanceCommon::new (#4106)
# Description of Changes

With this PR, all `VmMetrics` for all the reducers and views of a module
are made in `InstanceCommon::new`
so that they are never made in `call_{reducer/view}_with_tx`.

Here's a flamegraph before this PR, zooming in on the smaller
`call_reducer_with_tx`

<img width="1877" height="617" alt="image"
src="https://github.com/user-attachments/assets/9751c066-2bf0-4ded-a091-afa7d3b5dd75"
/>

And after, for the same `call_reducer_with_tx`:

<img width="1883" height="610" alt="image"
src="https://github.com/user-attachments/assets/27083acd-d4c9-4b69-94c7-c26c7f1e7cef"
/>

Here are the performance numbers:
```
wasm, index=hash, branch=master, commit = af4d3f39e4
ran for 10.097515999 seconds
completed 1310720
throughput was 129806.18204812016 TPS

wasm, index=hash, branch=master, commit = bac3d2a5a928af896d315fcfdf709d42e3577b66
ran for 10.842949063 seconds
completed 1474560
throughput was 135992.52301495385 TPS
```

As you can see, this is a gain of about 6k TPS on the phoenix_nap
machine.

The second commit also adds the `d3-flamegraph-base.html` and stuff to
`.gitignore` to facilitate taking flamegraphs.

# API and ABI breaking changes

None

# Expected complexity level and risk

1, trivial changes that are not load bearing.
2026-01-26 10:18:08 +00:00