rad experiment show 20b404dfcac87d16d26d70af1cfe4b76daa4889f
by ee@did:key:z6MkvsiybCuk1WDZhh2aXDx7NTiZejKgWZygMNsUuXDMNvVQ · Apr 20 11:22 2026
Remove runtime assert_eq! sanity check from fixed-width decoder macro to trim scalar read overhead in release builds.
Measurements
Metric
BaselineThe benchmark measurement of the unmodified code
CandidateThe code with the proposed optimization applied
Candidate/Parent ΔThe performance change from baseline to candidate
total_ns (ns)primary
Reduce the median per-iteration time of the existing nightly libtest deserialization benches in `rust-bitcoin`.
2385.640 ns (n=1)
2423.260 ns (n=1)
+1.57%REGRESSED
block_deserialize_nssecondary
2296.040 (n=1)
2331.310 (n=1)
+1.53%
tx_deserialize_nssecondary
89.600 (n=1)
91.950 (n=1)
+2.62%
Annotations
hypothesis
Every fixed-width integer decode pays the decoder_fn macro's assert_eq! path, so removing that release-time check might shave repeated scalar reads throughout transaction and block parsing.
learned
There may be a small benefit in trimming decoder scaffolding, but it is materially smaller than the transaction-level inlining win.
next_action_hint
If scalar-read micro-optimizations continue to show small wins, consider only combinations that also preserve the stronger transaction-level inline gains.
rollback_reason
This improved over baseline but not over the current best inline-only commit, so the gain was too small or too noisy to justify keeping separately.
Base CommitThe starting commit before the optimization was applied