dogecoin / dogecoin

very currency
MIT License
14.4k stars 2.8k forks source link

backport: Use FastRandomContext for all tests #3511

Open xanimo opened 1 month ago

xanimo commented 1 month ago

This is a follow up to #3487 and #3497 which are requirements which is a requirement needed in order to get #3229 in.

xanimo commented 1 month ago

(I will rebase accordingly as to give attribution to chromatic and ryanofsky as the review process continues.)

xanimo commented 1 month ago

Force pushed to give attribution to ryanofsky. Just noticing an extraneous #include <boost/filesystem.hpp> post #3488 so going to force push again shortly.

xanimo commented 1 month ago

Force pushed to remove extraneous boost headers

xanimo commented 1 month ago

Force pushed to add squashed commit db5041005aa84cbd97568800a6501bccd6d8063b to 28b9d89a50fa6a137c9558f90126dbf24dba6b11 and cherry-picks of https://github.com/dogecoin/dogecoin/commit/ee2d10ad0c0e04d0b9da4535a6fff265ac2501e5 and https://github.com/bitcoin/bitcoin/commit/c13c97db. I tried to add attribution to chromatic for their cherry-picks but it seems it didn't work.

xanimo commented 1 month ago

Force pushed reworked branch. I think I addressed all of the above but let me know if I missed anything.

patricklodder commented 1 month ago

I've tested performance for all tests that were edited between this PR at f9cd19f6b8 and 1.15.0-dev at 497c6026fc (except random tests as that's new) on an M1 with Apple clang 14.

c5938e53-997f-428c-87da-b03678c9a10d

script used icw hyperfine:

for t in DoS_tests addrman_tests blockencodings_tests bloom_tests checkqueue_tests coins_tests \
            crypto_tests cuckoocache_tests dbwrapper_tests merkle_tests miner_tests pmt_tests \
            pow_tests PrevectorTests script_tests sighash_tests skiplist_tests util_tests versionbits_tests; do 
  echo "'src/test/test_dogecoin -t $t'"; 
done | xargs -n1 hyperfine --warmup 2 -r 100 --style none --export-csv /dev/stdout --

This is consistent with what I measured with bench earlier and potentially can get a speedup from an unroll later, as discussed in #3487.