Repository navigation
Developer playground: compare Lambda before and after optimization - #8636
Conversation
| required | ||
|
|
||
| let compile (output_prefix : string) export_idents hoisted (lam : Lambda.t) = | ||
| let compile ?on_optimized_lambda (output_prefix : string) export_idents hoisted |
There was a problem hiding this comment.
Seems I cannot extract optimized lambda for the playground without this addition
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8636 +/- ##
==========================================
+ Coverage 81.11% 81.13% +0.01%
==========================================
Files 455 456 +1
Lines 63672 63724 +52
==========================================
+ Hits 51650 51700 +50
- Misses 12022 12024 +2
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8636 |
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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Review notes (no wrong-diff bugs found; mostly performance): Performance
Behaviour Nit Items 1, 2 and 6 share one fix: keep the view and its diff results alive across compiles, keyed on the input text, and render collapsed sections only when opened. 🤖 Generated with Claude Code |
443ae37 to
e33b965
Compare
|
Thanks, e33b965 addresses all eight points from my earlier review. Two minor leftovers, neither blocking:
🤖 Generated with Claude Code |
… including diffs Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
Keep the Lambda view mounted, cache its rendered comparison by input text, and render collapsed context only when expanded. Preserve expansion for unchanged regions across edits. Count shared edges once in the line budget, prioritize atoms in token alignment, and admit whole changed blocks before charging the shared token budget. Cover the algorithm and rendering regressions, and document the API v9 capture boundary. Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
Keep the Before and After dumps unchanged while the Lambda view is hidden. Opening the view reads the latest compiler result. While Diff is open, wait 200 ms after the latest changed result before replacing its comparison; opening Diff remains immediate. Leaving Diff or unmounting cancels its timer. Review: Address cknitt's two non-blocking follow-ups. Regression tests cover hidden panels catching up, consecutive edits, cancellation on tab switches, and expanded context surviving the delayed update. Validation: All 36 developer playground tests, the native compiler suites, the browser compiler bundle tests, production Vite build, OCaml/ReScript/JS format checks, and changelog validation pass after rebasing onto b7c67d2. Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
7da4716 to
8eac328
Compare
|
Thanks, 8eac328 addresses both follow-ups:
One tiny nit, not blocking: on the Lambda tab with a compile error, 🤖 Generated with Claude Code |
Give the cached panel input an identity equality check so repeated errors on the Lambda tab do not notify the unchanged Before and After panels. Review: Address cknitt's final non-blocking follow-up. The regression test reproduces the After panel being rebuilt without this check, verifies reuse across repeated errors, and checks recovery when compilation succeeds. Validation: All 37 developer playground tests, the production Vite build, and the changed files' ReScript/JavaScript format checks pass. Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
Keep the visible panel snapshot in a signal updated by an owned effect. Repeated compile errors leave the signal untouched, so neither hidden panel is invalidated. Showing the Lambda tab publishes the latest input. Why: The locked rescript-signals 3.1.1 still invalidates downstream computeds despite panelInput's equality check. The local install used 3.1.4 and missed this behavior. Reproduced the CI failure with 3.1.1; the existing panel-reuse regression now passes on the locked version. Validation: All 37 playground tests pass with Node 22.23.3 and the locked rescript-signals 3.1.1. The playground compiler build, production Vite build, ReScript formatting, and diff checks pass. Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
Add Before, After, and Diff views to the developer playground's Lambda tab. Playground API v9 exposes
lambda_optimizedfromcompileWithDebugafter the whole-term Lambda passes and before export grouping and JavaScript lowering. Regular compilation does not capture debug output; older compiler bundles retain an availability notice.Keep the Lambda view mounted and cache the latest rendered comparison by its printed inputs, including line alignment, inline highlights, and context sections. Switching tabs or recompiling identical dumps reuses the diff DOM. Collapsed context renders only when expanded, and unchanged regions retain their expansion state across edits. Hidden Lambda panels keep their dump snapshot in a signal that is updated only while visible. Repeated compile errors leave that snapshot untouched, including with the locked rescript-signals 3.1.1. While Diff is open, changed output is debounced for 200 ms; opening Diff is immediate, and leaving it or unmounting cancels pending work.
Strip shared edges before the line comparison, count those edges once in the output budget, and omit empty visible sections. Token alignment prioritizes shared atoms over punctuation. Preflight all candidate work in a changed block and skip the whole block when it cannot fit the remaining global budget, preserving capacity for later small changes. Actual work on unchosen candidates remains counted so the overall bound still holds.
Validation:
yarn workspace dev-playground testandyarn workspace dev-playground buildwith Node 22 and the immutable lockfile dependencies.node scripts/test.js -ounit -mocha -build -docstrings) passes: 336 unit cases (one skipped), 622 runtime/Belt tests, all 42 build fixtures, and 744 documentation examples.