Skip to content

Run the cases with only the environment variables the configuration keeps - #6

Merged
ondrejmirtes merged 1 commit into
1.xfrom
worker-environment
Nov 14, 2026
Merged

ondrejmirtes merged 1 commit into
1.xfrom
worker-environment

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

The environment is on the stack of the counted process, so variables that differ from run to run, such as GITHUB_HEAD_REF in CI, moved its memory layout and with it the counts of benchmarks whose allocations depend on it. In phpstan-src, 3,000 more bytes of environment moved FileCacheStorageBench::benchSave@entries-10000 from 18.69M to 18.88M instructions and from 30.0M to 32.5M cycles.

Configuration::withEnvironmentVariables(list<string>) lists the variables the workers keep; tally run leaves out the others and adds VALGRIND_LIB. The default is PATH, HOME, TMPDIR, LANG, LC_ALL, PHPRC, and PHP_INI_SCAN_DIR.

With this branch installed in phpstan-src, the same benchmark counts 18,474,371 instructions with 0, 3,000, and 9,000 bytes of extra environment.

…eeps

The environment is on the stack of the counted process, so variables that
differ from run to run, such as the branch name in CI, moved its memory
layout and the counts of benchmarks whose allocations depend on it:
3,000 more bytes of environment moved phpstan-src's
FileCacheStorageBench::benchSave@entries-10000 by 1 % of instructions and
8 % of cycles. withEnvironmentVariables() lists the variables the workers
keep, PATH, HOME, TMPDIR, LANG, LC_ALL, PHPRC, and PHP_INI_SCAN_DIR by
default.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
@ondrejmirtes
ondrejmirtes merged commit d349e0a into 1.x Nov 14, 2026
27 checks passed
@ondrejmirtes
ondrejmirtes deleted the worker-environment branch November 14, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant