Coin Brief ENDE

Bitcoin Core cuts functional test time by removing waits; one test drops from 58 to 6 s

Bitcoin Core merged pull request 36440 on 13 October, a change to the project's functional test suite rather than to the node itself. It removes waits that tests did not need, and the numbers in the PR show how much time they were costing.

What changed. Two things. First, tests that can benefit from it now set the node option noban_tx_relay = True. Second, the Python test framework's P2PInterface.wait_until now wakes up as soon as a message is delivered or the connection state changes, instead of polling every 50 milliseconds. The patch touches eight files, with 25 lines added and one removed.

The measurements. The author reports, on an x86-64 machine running 18 tests in parallel:

  • wall time from 110.8 s to 99.1 s (−11%);
  • accumulated test time from 1,715 s to 1,411 s (−17.5%).
Bitcoin Core cuts functional test time by removing waits; one test drops from 58 to 6 s
Bitcoin Core cuts functional test time by removing waits; one test drops from 58 to 6 s — Coin Brief

The largest single gains were in tests dominated by waiting: feature_maxuploadtarget went from 57.9 s to 6.2 s, wallet_conflicts from 49.2 s to 7.0 s, p2p_sendheaders from 31.1 s to 6.8 s and p2p_compactblocks from 11.1 s to 1.7 s. wallet_orphanedreward and wallet_importprunedfunds also roughly halved.

Why it matters. The functional suite is run by contributors and in continuous integration, so a sixth less accumulated time is a saving on every run. It also changes what a slow test means: a test that took nearly a minute because it waited on fixed intervals was hiding how little work it actually did.

What it does not change. Nothing in the node's consensus, policy or networking behaviour; noban_tx_relay is set only inside the tests that use it.

Source: Bitcoin Core, pull request 36440 "test: speed up functional tests by removing avoidable waits" — https://github.com/bitcoin/bitcoin/pull/36440