Skip to content

Replace fixed test delays with deterministic synchronization - #22948

Draft
NickSdot wants to merge 3 commits into
php:masterfrom
NickSdot:perf/deterministic-test-waits
Draft

Replace fixed test delays with deterministic synchronization#22948
NickSdot wants to merge 3 commits into
php:masterfrom
NickSdot:perf/deterministic-test-waits

Conversation

@NickSdot

@NickSdot NickSdot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Extracted from #22917.

Replaces fixed delays in filesystem, OPcache and proc_open() tests with deterministic synchronisation. Tests now advance timestamps explicitly, poll observable state with bounded timeouts, or use socket handshakes instead of waiting for assumed durations. This preserves the original assertions while reducing runtime and timing related flakiness.

Result

Values in seconds; measured on macOS.

mode master this PR saved speedup
-j1 29.576 4.774 24.802 6.20×
-j10 12.986 2.940 10.046 4.42×

Reproduction:

sapi/cli/php run-tests.php -q -j10 \
    ext/opcache/tests/issue0140.phpt \
    ext/standard/tests/file/001.phpt \
    ext/standard/tests/file/lstat_stat_basic.phpt \
    ext/standard/tests/file/lstat_stat_variation10.phpt \
    ext/standard/tests/file/lstat_stat_variation11.phpt \
    ext/standard/tests/file/lstat_stat_variation13.phpt \
    ext/standard/tests/file/lstat_stat_variation15.phpt \
    ext/standard/tests/file/lstat_stat_variation4.phpt \
    ext/standard/tests/general_functions/bug39322.phpt \
    ext/standard/tests/general_functions/proc_open_pipes1.phpt \
    ext/standard/tests/general_functions/proc_open_pipes2.phpt \
    ext/standard/tests/general_functions/proc_open_pipes3.phpt \
    ext/standard/tests/general_functions/proc_open_sockets1.phpt \
    ext/standard/tests/general_functions/proc_open_sockets2.phpt \
    ext/standard/tests/general_functions/proc_open_sockets3.phpt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment