Title: BCLog::Bench - Timing nothing of value Post by: dougEfish on September 22, 2021, 02:44:28 PM I recently setup up a new node and was perplexed why processing the chain took longer than expected.
I'm downloading from another node on my local gigabit network, so bandwidth wasn't my bottleneck. I saw a -debug flag with a bench property, so I enabled this setting. Long story short, the disk I used was really slow. Anyways, I came across some code that doesn't seem to time anything of value: Code: int64_t nTime5 = GetTimeMicros(); nTimeIndex += nTime5 - nTime4; This is in https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1873 (https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1873) Correct if I'm wrong, but it seems "Callbacks" is timing the execution of the "Index writing" LogPrintf along with some basic computations (nTime6 - nTime5) Inspection of my debug.log indicates a consistent time of around ~20-30 microseconds. Is this timing anything of value? Callbacks bench was added (I think) in this commit: https://github.com/bitcoin/bitcoin/commit/d70bc52ee31b8c4c87ee011625e7031c2dc89c0c (https://github.com/bitcoin/bitcoin/commit/d70bc52ee31b8c4c87ee011625e7031c2dc89c0c) If this is dead (legacy) code, I'll open merge request and remove it. Could someone confirm ? Thanks. Title: Re: BCLog::Bench - Timing nothing of value Post by: achow101 on September 22, 2021, 04:24:50 PM Looking at when that was added, there was stuff in between those log lines which are reasonable to benchmark. Those were the callbacks to the wallet to add the transaction to the wallet, hence the log line "callbacks". But that has since moved elsewhere and become asynchronous, so this log line isn't doing anything useful and could be removed.
Title: Re: BCLog::Bench - Timing nothing of value Post by: dougEfish on September 23, 2021, 08:51:36 AM Thanks
PR https://github.com/bitcoin/bitcoin/pull/23072 Issue https://github.com/bitcoin/bitcoin/issues/23071 |