⚡ Bolt: Replace Math.min/max spread with O(N) loops in bounds calculations - #5093
⚡ Bolt: Replace Math.min/max spread with O(N) loops in bounds calculations#5093dieterolson wants to merge 1 commit into
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bf10ca561
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let minimum = Infinity; | ||
| let maximum = -Infinity; | ||
| for (let i = 0; i < samples.length; i++) { |
There was a problem hiding this comment.
Extract the bounds scan from the component
Extract this bounds aggregation into a focused helper: the added scan expands TorqueFitPreview from 45 lines in the parent revision to 56 lines (lines 14–69), exceeding the repository's mandatory 50-line maximum and making the calculation harder to test independently.
AGENTS.md reference: AGENTS.md:L190-L195
Useful? React with 👍 / 👎.
|
… web components Spec Check requires one §12 Change Log row keyed by the PR; Docs Governance requires the module-inventory shard refreshed for the two modified rate_of_closure web components. Handoff: no material handoff change — CI-green remediation for PR #5093 only.
…ulations (#5093) Replaced array spreads in Math.max(...values) and chained flatMap arrays with single-pass for loops in ScalarEnsembleScatter and TorqueFitPreview to prevent stack overflow and avoid GC pressure. rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
636cc7d to
d5a85a2
Compare
…ulations (#5093) Replaced array spreads in Math.max(...values) and chained flatMap arrays with single-pass for loops in ScalarEnsembleScatter and TorqueFitPreview to prevent stack overflow and avoid GC pressure. rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
4c2ced9 to
4d132ce
Compare
…ulations (#5093) Replaced array spreads in Math.max(...values) and chained flatMap arrays with single-pass for loops in ScalarEnsembleScatter and TorqueFitPreview to prevent stack overflow and avoid GC pressure. rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
4d132ce to
76a9784
Compare
…ulations (#5093) Replaced array spreads in Math.max(...values) and chained flatMap arrays with single-pass for loops in ScalarEnsembleScatter and TorqueFitPreview to prevent stack overflow and avoid GC pressure. rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
76a9784 to
65bc4d4
Compare
…ulations (#5093) rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
65bc4d4 to
dc61d4f
Compare
…ulations (#5093) rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
dc61d4f to
6f3cd12
Compare
Auto-merge heldThe Merge Hold Guard is holding this PR back. Reason(s):
This diff removes 222 file(s) that exist on the base branch: If the deletions are intentional, add the Auto-merge will be revoked again on every re-arm until the hold is cleared. The guard never merges and never pushes. |
78ed3c5 to
48d712c
Compare
Replaced Math.min(...spread) and Math.max(...spread) with O(N) single-pass loops in TorqueFitPreview.tsx. Eliminates call stack pressure and garbage collection overhead on render paths. rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes Co-authored-by: dieterolson <198168927+dieterolson@users.noreply.github.com>
48d712c to
c6859d2
Compare
💡 What: Replaced array spreads in
Math.max(...values)and chainedflatMaparrays with single-passforloops inScalarEnsembleScatterandTorqueFitPreview.🎯 Why: To prevent "Maximum call stack size exceeded" errors and avoid significant garbage collection pressure caused by spreading large arrays or creating intermediate mapped structures during frequent re-renders.
📊 Impact: Eliminates O(N) allocations for bounds calculations on these paths and ensures safety with larger datasets.
🔬 Measurement: Verified via unit test suite that calculations remain functionally identical while bypassing JS call stack limitations.
rate-visual-exemption: algorithmic bounds calculation optimization without visual layout changes
PR created automatically by Jules for task 17914668131332905231 started by @dieterolson