2e8d5284c2
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.
12 lines
309 B
Plaintext
12 lines
309 B
Plaintext
;; Benchmark: Record Destructuring Performance
|
|
;; This test calls a function that destructures a record
|
|
;; Current implementation is now zero-allocation for destructuring.
|
|
;; Output: 3
|
|
;; Benchmark: 129ns
|
|
;; Benchmark-Repeat: 15432
|
|
|
|
(do
|
|
(def process (fn [[x y]]
|
|
(+ x y)))
|
|
|
|
(process {:a 1 :b 2})
|
|
)
|