Skip to content

refactor: iterative water-filling for available space delta#131

Open
andyhorn wants to merge 1 commit into
mainfrom
iterative-water-filling
Open

refactor: iterative water-filling for available space delta#131
andyhorn wants to merge 1 commit into
mainfrom
iterative-water-filling

Conversation

@andyhorn
Copy link
Copy Markdown
Owner

Summary

  • Closes _distributeAvailableSpaceDelta recurses; convert to iterative water-filling #118
  • Replaces the recursive _distributeAvailableSpaceDelta with an iterative water-filling loop that reuses a single mutable working-sizes buffer.
  • Each pass distributes the residual delta equally amongst still-changeable children, caps each at its allowable change, and saturates at least one child — bounding the loop at ~2n iterations (expand-priority set, then fallback set) for O(n²) total work with much smaller constants than the prior recursion.

Test plan

  • flutter test — all 145 tests pass, including the #setAvailableSpace cases that exercise the expand-with-max-constraint redistribution path.
  • dart analyze lib/src/resizable_controller.dart — clean.

🤖 Generated with Claude Code

…illing

Replaces the recursive implementation that rebuilt changeable indices,
maximum allowances, and full index lists per recursion. The iterative
loop reuses a single mutable working-sizes buffer and saturates at least
one child per pass, bounding total work at O(n^2) with much smaller
constants.

Closes #118
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.

_distributeAvailableSpaceDelta recurses; convert to iterative water-filling

1 participant