Update record_unpack example
This commit is contained in:
@@ -1,20 +1,11 @@
|
|||||||
;; Benchmark: Record Destructuring Performance
|
;; Benchmark: Record Destructuring Performance
|
||||||
;; This test calls a function that destructures a record 100.000 times.
|
;; This test calls a function that destructures a record
|
||||||
;; Current implementation is now zero-allocation for destructuring.
|
;; Current implementation is now zero-allocation for destructuring.
|
||||||
;; Output: {:a 1, :b 2}
|
;; Output: 3
|
||||||
;; Benchmark: 5.2ms
|
;; Benchmark: 775ns
|
||||||
|
;; Benchmark-Repeat: 2587
|
||||||
|
|
||||||
(do
|
(do
|
||||||
(def process (fn [[x y]]
|
(def process (fn [[x y]]
|
||||||
(+ 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
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user