Repository navigation
Conversation
Changelog💅 Polish
Semantic Diff1 commit · Full page Find duplicate pattern variables in a set of the bound names4bae89d · cknitt + Claude · Nov 07, 2026, 10:07 UTC
The names are kept in a set next to the list of variables, in one value, so that resetting the pattern and the save and restore around or-patterns carry both. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9260 +/- ##
==========================================
- Coverage 82.06% 82.06% -0.01%
==========================================
Files 455 455
Lines 65399 65398 -1
==========================================
- Hits 53672 53669 -3
- Misses 11727 11729 +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-9260 |
7d5740b to
4bae89d
Compare
🎉 Compiler benchmarksAllocated wordsIn total: 456,989,425 → 457,158,125 (+0.04%).
InstructionsIn total: 10,226,962,259 → 10,126,222,706 (-0.99%). 🎉 Improvement: 1 benchmark executes more than 1% fewer instructions.
Pull request 4bae89d compared with base bf35764 in this run. |
Why:
Each new pattern variable was compared with every variable the
pattern had bound so far, and a `let rec … and …` group is one
pattern, so n bindings cost O(n²) string comparisons: 16,000 bindings
took 2.7 s. They now take 2.0 s.
The names are kept in a set next to the list of variables, in one value,
so that resetting the pattern and the save and restore around or-patterns
carry both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gK1dcjbe97yY1wRMgs
Signed-off-by: Christoph Knittel <ck@cca.io>
4bae89d to
3f4f6a8
Compare
Changelog💅 Polish
Semantic Diff1 commit · Full page Find duplicate pattern variables in a set of the bound names3f4f6a8 · cknitt + Claude · Nov 07, 2026, 10:07 UTC
The names are kept in a set next to the list of variables, in one value, so that resetting the pattern and the save and restore around or-patterns carry both. |
🎉 Compiler benchmarksAllocated wordsIn total: 640,950,324 → 641,189,611 (+0.04%). Generated projects: 920,893,010 → 920,935,581 (±0.00%).
InstructionsIn total: 9,209,714,002 → 9,106,358,404 (-1.12%). 🎉 Improvement: 1 benchmark executes more than 1% fewer instructions.
Output sizeIn total: 25,843,406 → 25,843,416 (±0.00%). None of the 13 benchmarks changed by 0.1% or more. Pull request 3f4f6a8 compared with base a531dc3 in this run. |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9260 |
Part of #9256 (duplicate check of pattern variables).
Typecore.enter_variablecompared each new variable with all variables of the pattern so far, and alet rec … and …group is one pattern. The bound names are now kept in a set next to the list. Both live in one value of the request state, so resetting the pattern,add_pattern_variablesand the save and restore around or-patterns carry the set along without extra code.Measured with
bscon linux-arm64, alet recgroup of n bindings (allocations were already linear; this saves string comparisons):New tests:
multiply_bound_variable_let_rec(a duplicate in alet recgroup),multiply_bound_variable_or_pattern(an or-pattern binding the same name on both sides is accepted, then a real duplicate is reported) andmultiply_bound_variable_alias(Some(a) as a).🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gK1dcjbe97yY1wRMgs