Feat: Enable nested destructuring optimization

This commit introduces optimizations for nested destructuring, allowing
tuples and records to be flattened and matched directly against function
arguments. This significantly improves performance by enabling more
constant folding and reducing intermediate allocations.

The changes include:
- Modifying the `Binder` to correctly count nested parameters.
- Enhancing `flatten_tuple` in the `Optimizer` to handle records and NOP
  nodes.
- Updating `map_params_to_args` to recursively destructure nested
  compound arguments.
- Adding integration tests to verify the correctness of tuple-to-tuple
  and record-to-tuple destructuring optimizations.
This commit is contained in:
Michael Schimmel
2026-02-22 16:34:40 +01:00
parent c03b2af770
commit 2e8d5284c2
5 changed files with 68 additions and 23 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 2.1us
;; Benchmark-Repeat: 961
;; Benchmark: 969ns
;; Benchmark-Repeat: 2078
;; Comprehensive Destructuring Test
;; Covers: Nested tuples, mixed params, dynamic passing