Header menu logo CodecMapper

How To Profile Benchmark Hot Paths

Use this guide when benchmark ratios point at a real hotspot and you need call-stack evidence before changing the runtime.

What this workflow does

The repo ships a focused benchmark-runner profile mode plus a perf wrapper script:

bash scripts/profile-benchmark-hot-path.sh codecmapper-serialize 120000 person-batch-25

That command:

Artifacts land under .artifacts/profiling/<operation>-<scenario-or-records>-<iterations>iters/.

Supported operations

Typical workflow

Profile the CodecMapper path first:

bash scripts/profile-benchmark-hot-path.sh codecmapper-serialize 120000 person-batch-25
bash scripts/profile-benchmark-hot-path.sh codecmapper-deserialize-bytes 40000 person-batch-25-unknown-fields

Then capture the System.Text.Json baseline on the same scenario:

bash scripts/profile-benchmark-hot-path.sh stj-serialize 120000 person-batch-25
bash scripts/profile-benchmark-hot-path.sh stj-deserialize 40000 person-batch-25-unknown-fields

Read perf.stat.txt for high-level counters and perf.report.txt for the hottest call paths.

Notes

Type something to start searching.