Commit 922c49a
committed
Merge bitcoin#23819: ConnectBlock: don't serialize block hash twice
eb8b22d block_connected: re-use previous GetTimeMicros (William Casarin)
80e1c55 block_connected: don't serialize block hash twice (William Casarin)
Pull request description:
In the validation:block_connected tracepoint, we call block->GetHash(), which
ends up calling CBlockHeader::GetHash(), executing around 8000 serialization
instructions. We don't need to do this extra work, because block->GetHash() is
already called further up in the function. Let's save that value as a local
variable and re-use it in our tracepoint so there is no unnecessary tracepoint
overhead.
Shave off an extra 100 or so instructions from the validation:block_connected
tracepoint by reusing a nearby GetTimeMicros(). This brings the tracepoint down
to 54 instructions. Still high, but much better than the previous ~154 and
8000 instructions which it was originally.
Signed-off-by: William Casarin <[email protected]>
ACKs for top commit:
0xB10C:
ACK eb8b22d
laanwj:
Code review ACK eb8b22d
theStack:
re-ACK eb8b22d
Tree-SHA512: 92ae585e487554e0f73042a8abaa239f630502c1d198e010bd7c1de252d882bccb627bbf0e4faec09c1253e782b145bcf153f9fee78cdb8456188044a96f82671 file changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1923 | 1923 | | |
1924 | 1924 | | |
1925 | 1925 | | |
1926 | | - | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1927 | 1930 | | |
1928 | 1931 | | |
1929 | 1932 | | |
| |||
1957 | 1960 | | |
1958 | 1961 | | |
1959 | 1962 | | |
1960 | | - | |
| 1963 | + | |
1961 | 1964 | | |
1962 | 1965 | | |
1963 | 1966 | | |
| |||
2214 | 2217 | | |
2215 | 2218 | | |
2216 | 2219 | | |
2217 | | - | |
| 2220 | + | |
2218 | 2221 | | |
2219 | 2222 | | |
2220 | 2223 | | |
2221 | 2224 | | |
2222 | | - | |
| 2225 | + | |
2223 | 2226 | | |
2224 | 2227 | | |
2225 | 2228 | | |
| |||
0 commit comments