Skip to content

Refactor lspecIO for memory efficiency and add test suite#72

Merged
johnchandlerburnham merged 2 commits intomainfrom
jcb/memory
Mar 4, 2026
Merged

Refactor lspecIO for memory efficiency and add test suite#72
johnchandlerburnham merged 2 commits intomainfrom
jcb/memory

Conversation

@johnchandlerburnham
Copy link
Member

Replace for-loop iteration in lspecIO with tail-recursive helpers (runSuites/runTests) over a plain List, allowing Lean's reference counting to free each TestSeq after it finishes running. Compute map.size before converting to a list so the HashMap can be freed before the long-running test execution begins.

Add a comprehensive test suite (27 tests across 8 suites) runnable via lake test, covering runIO basics, grouping, IO tests, combinators, append, property tests, lspecIO integration, and lspecEachIO. Includes an opt-in memory stress suite (lake test -- memory) that allocates 50 × 100MB to verify RSS stays bounded.

Replace for-loop iteration in lspecIO with tail-recursive helpers
(runSuites/runTests) over a plain List, allowing Lean's reference
counting to free each TestSeq after it finishes running. Compute
map.size before converting to a list so the HashMap can be freed
before the long-running test execution begins.

Add a comprehensive test suite (27 tests across 8 suites) runnable
via `lake test`, covering runIO basics, grouping, IO tests,
combinators, append, property tests, lspecIO integration, and
lspecEachIO. Includes an opt-in memory stress suite
(`lake test -- memory`) that allocates 50 × 100MB to verify RSS
stays bounded.
Copy link
Member

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to run lake test on CI?

@johnchandlerburnham johnchandlerburnham enabled auto-merge (squash) March 4, 2026 22:48
@johnchandlerburnham johnchandlerburnham merged commit 928f27c into main Mar 4, 2026
5 checks passed
@johnchandlerburnham johnchandlerburnham deleted the jcb/memory branch March 4, 2026 22:49
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.

2 participants