Repository navigation
fix: a column ELSE is measured once, so a decision chain describes in linear time - #2712
Merged
Merged
Conversation
… linear time Under IfElseColumn (preset true-right-false-down), measureIf measured the ELSE body as a branch, discarded that, and measured it again as a column. Each nested IF did both, so a chain of N decisions cost 2^N: 20 took 3s and 58 never finished, describe module --all included. The ELSE body is now measured once, the way the style draws it; describe output is unchanged. Closes #2704 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011oK82qrr1WnXxq1eRn7qRJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2704 (upstream mendixlabs#1989)
What was wrong
With
flows: preset: true-right-false-down,describe microflowtook time that doubled with every nested decision. A chain of 58if … then return …; else if …never finished, anddescribe module --allstopped at the first such flow.MXCLI_CPUPROFILEon a 20-deep chain put 86% of the time underlayoutMeasurer.measureIf→measureColumn. UnderIfElseColumn,measureIfmeasured the ELSE body twice:measureBranch, a result the column measurement then replaced;measureColumn.Both recurse into the nested IF, so a chain of N cost 2^N. The default style measures it once, which is why it stayed at 0.3 s.
Fix
mdl/executor/layout.go: the ELSE body is measured once, as a column underIfElseColumnand as a branch otherwise. The widths and heights computed are the same as before.Measured (scratch TestApp copy, the issue's chain shape)
describeoutput is byte-identical, old build vs new, on three of the flows.Tests
TestMeasureColumnElseChainIsLinear_2704measures a 40-decision chain under a 5 s deadline. 2^40 cannot finish in that time; a linear measurement takes microseconds, so there is no timing flake.make ci-localpassed. The first run ran out of disk; I cleaned up leftover test temp dirs and re-ran.#2705 (a Studio Pro-drawn 57-decision flow that hangs) is not closed here. Its reporter says the same chain created by mxcli describes in 0.4 s, which points away from the preset. It needs their flow or confirmation of the config.
Generated by Claude Code