Files
RustAst/examples/record_unpack.myc
T
Michael Schimmel 87259584ee Refactor Record and List to use TupleData
The `Value::List` and `Value::Record` variants have been consolidated
into a single `Value::Tuple` variant. This new variant uses a
`TupleData` struct to store values and an optional `Rc<Vec<Keyword>>`
for keys, allowing it to represent both ordered lists/tuples and
key-value records.

This change simplifies the internal representation and improves
performance by allowing schema sharing for records. It also includes
updates to the compiler, runtime, and tests to reflect the new
structure.
2026-02-20 16:13:38 +01:00

20 lines
436 B
Plaintext

;; Benchmark: Record Destructuring Performance
;; This test calls a function that destructures a record 100.000 times.
;; Current implementation is now zero-allocation for destructuring.
;; Output: {:a 1, :b 2}
;; Benchmark: 5.3ms
(do
(def process (fn [[x y]]
(+ x y)))
(def rec {:a 1 :b 2})
(def loop (fn [n acc]
(if (= n 0)
acc
(loop (- n 1) (process rec)))))
(loop 10000 0)
rec
)