[Chronik] Optimize Subs by short-circuiting if empty
Summary:
Currently, quite a bit of time is spent in handle_tx_event during IBD, even if there's no subscribers.
When syncing the first 30000ish blocks with all indices disabled (i.e. only loading of blocks etc.), we shave off around 150s. Most of this comes from ScriptGroup allocating 2 Vecs for each txs, which is mostly fixed by D15545, however, there's still a remainder of 30s overhead which this diff saves.
bench | time [s] |
master | 969.39 |
this diff | 821.10s |
master + D15545 | 850.29s |
Test Plan: ninja check-functional
Reviewers: Fabien, #bitcoin_abc
Reviewed By: Fabien, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D15552