tofusoup
2026-03-21
Memray profiling infrastructure, discovery glob optimization, and 0.3.21 release
17 files · 1,368+ · 849-
Optimize stir discovery glob matching to O(1)
1 file changed
discovery.pyPre-compiles fnmatch glob patterns into combined alternation regexes at construction time; hot-path path exclusion check now uses compiled regex match instead of iterating per-pattern. Also pre-compiles path filter patterns in TestFilter.
- Added _compile_glob() and _combine_globs() helpers that translate fnmatch patterns into compiled re.Pattern objects. StirDiscovery now builds _default_name_re, _default_substr_re, and _user_re at init time so the should_exclude() hot path does a single regex check rather than looping over every pattern on each directory traversal step.
streamline
behavioral
1 file
discovery.py
- TestFilter pre-compiles path_filters into a list of (is_negated, Pattern) tuples, replacing the per-call fnmatch.fnmatch() loop in the filter hot path.
streamline
behavioral
1 file
discovery.py
Remove redundant is_debug_enabled() guards
7 files changed
cli.pyRemoved is_debug_enabled() guards around debug() callscli.pyRemoved is_debug_enabled() guards around debug() callsbase.pyRemoved is_debug_enabled() guard around debug() callengine.pyRemoved is_debug_enabled() guards across all debug() call sitesclient.pyRemoved is_debug_enabled() guards across all debug() call sitesstate.pyRemoved is_debug_enabled() guard around debug() calllogic.pyRemoved is_debug_enabled() guard around debug() call
- Removed the if logger.is_debug_enabled(): pattern from all call sites in cli.py, hcl/cli.py, registry/base.py, registry/search/engine.py, rpc/client.py, state.py, and testing/logic.py. The logger handles level-gating internally; the guards were redundant and added visual noise. This is the inverse of the 2026-03-20 change — that commit added guards for f-string construction; this removes them where the logger already handles it.
decouple
internal
7 files
cli.pycli.pybase.pyengine.pyclient.pystate.pylogic.py
Add memray stress test scripts
3 files changed
memray_discovery_stress.pyStress test targeting TestDiscovery and TestFilter hot paths — builds a synthetic 80-dir tree and runs repeated discovery passesmemray_state_stress.pyStress test targeting state read/write hot pathsmemray_wire_stress.pyStress test targeting wire/RPC hot paths
- Three standalone scripts that drive the hot paths in stir discovery, state, and wire under memray profiling. Each builds a synthetic workload (e.g. 80-directory test tree for discovery) and runs it repeatedly so memray can capture allocation patterns. Intended for use with wrknv memray stress.
qualify
internal
3 files
memray_discovery_stress.pymemray_state_stress.pymemray_wire_stress.py
Add memray baseline test suite
6 files changed
__init__.pyPackage init for memray test suitebaselines.jsonMemory baseline thresholds (peak allocations) for each hot pathconftest.pyShared fixtures for memray teststest_discovery_mem.pyMemory regression test for stir discovery hot pathtest_state_mem.pyMemory regression test for state hot pathtest_wire_mem.pyMemory regression test for wire/RPC hot path
- Memray-based memory regression tests for the three hot paths — discovery, state, and wire. Each test exercises the path and asserts peak allocations stay within the thresholds in baselines.json. Marked with the memray pytest marker so they are excluded from the default test run and only run explicitly with -m memray.
qualify
internal
6 files
__init__.pybaselines.jsonconftest.pytest_discovery_mem.pytest_state_mem.pytest_wire_mem.py
Release 0.3.21: dependency pins, config, and lockfile
5 files changed
VERSIONBumped to 0.3.21pyproject.tomlPin provide-foundation>=0.3.21; add pytest-httpx to dev deps; exclude memray marker from default pytest run; register memray markerwrknv.tomlAdd memray task group with default and stress variants.gitignoreIgnore memray-output/ and .actrcuv.lockLockfile update for provide-foundation 0.3.21.post1 and pytest-httpx addition
- Pinned provide-foundation[all]>=0.3.21 in pyproject.toml and upgraded to provide-foundation 0.3.21.post1 in the lockfile.
baseline
internal
2 files
pyproject.tomluv.lock
- Added pytest-httpx>=0.35.0 to dev dependencies; added tests/memray to testpaths; registered the memray marker; excluded memray tests from the default pytest addopts.
baseline
internal
1 file
pyproject.toml
- Added wrknv memray task group: default runs pytest tests/memray/ -m memray; stress runs all three stress scripts in sequence.
baseline
internal
1 file
wrknv.toml
- Gitignored memray-output/ (profiling artifacts) and .actrc (local act CI config). Bumped VERSION to 0.3.21.
baseline
internal
2 files
.gitignoreVERSION