You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* test: add reproduction for exponential compile time bug
Large records with 26+ optional fields cause exponential compile time
growth due to nested switch statements in generated decoder code.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: O(n) nested match decoder replaces O(n²) tuple pattern matching
The previous decoder generated O(n²) pattern matches for records with n fields,
causing exponential compile time growth in the ReScript type checker.
This fix uses nested match expressions instead, generating O(n) AST nodes:
- Before: 26 fields = ~102 seconds compile time
- After: 26 fields = ~0.7 seconds compile time
The fix is minimal and surgical - only records.ml is changed.
It preserves all existing behavior and passes all tests.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: prioritize @spice.default over is_option in pattern matching
For a field like `field: option<int> [@spice.default Some(1)]`, the previous
pattern matching order would match `| _, true, _` (is_option=true) before
`| _, _, Some d` (has default), causing the default value to be ignored.
Reordered patterns to check for default values first:
1. `| _, _, Some d` - If there's ANY default, use it
2. `| true, _, None` - Optional field, no default -> Ok None
3. `| _, true, None` - Option type, no default -> Ok None
4. `| _, _, None` - Required field, no default -> error
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* changelog
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: mununki <woonki.moon@gmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
## 0.3.2(unreleased)
4
4
5
+
- Fixes O(n) nested match decoder replaces O(n²) tuple pattern matching to prevent the hang with the recode with many fields https://github.com/green-labs/ppx_spice/pull/111
6
+
5
7
## 0.3.1
6
8
7
9
- Fixes [#107](https://github.com/green-labs/ppx_spice/issues/107) Arrays being reversed by Spice.arrayFromJson
0 commit comments