Skip to content

Replace body_length heuristic with random ordering#425

Merged
MatthewMckee4 merged 1 commit intomainfrom
remove-body-length-use-random-ordering
Feb 7, 2026
Merged

Replace body_length heuristic with random ordering#425
MatthewMckee4 merged 1 commit intomainfrom
remove-body-length-use-random-ordering

Conversation

@MatthewMckee4
Copy link
Member

Summary

  • Removed body_length (AST node count) from TestInfo and all weight calculations in the partitioning algorithm
  • Tests without historical durations are now shuffled randomly via fastrand and assigned equal weight (1), replacing the body length heuristic
  • Simplified compare_test_weights to treat tests without durations as equal

Test plan

  • just test — all 391 tests pass
  • prek run -a — all pre-commit checks pass

🤖 Generated with Claude Code

…durations

The partitioning algorithm used AST body length as a fallback weight when
historical durations weren't available. This added complexity without much
benefit. Now tests without durations are shuffled randomly and assigned
equal weight, simplifying the logic while achieving better distribution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Project Diff Results

No changes between this PR and main.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 7, 2026

Merging this PR will not alter performance

✅ 1 untouched benchmark


Comparing remove-body-length-use-random-ordering (beb3a93) with main (8a799e7)

Open in CodSpeed

@MatthewMckee4 MatthewMckee4 merged commit 782ec58 into main Feb 7, 2026
13 checks passed
@MatthewMckee4 MatthewMckee4 deleted the remove-body-length-use-random-ordering branch February 7, 2026 12:19
@MatthewMckee4 MatthewMckee4 added the test-running Related to running tests with karva label Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-running Related to running tests with karva

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant