mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
20 lines
444 B
Plaintext
20 lines
444 B
Plaintext
(load "Bench.carp")
|
|
(use Bench)
|
|
(Debug.sanitize-addresses)
|
|
|
|
(def n 10000)
|
|
|
|
(defn grow-and-shrink []
|
|
(ignore (let-do [a [0]]
|
|
(for [i 1 n]
|
|
(set! a (Array.push-back a i)))
|
|
(assert (= n (Array.length &a)))
|
|
(for [i 1 n]
|
|
(set! a (Array.pop-back a)))
|
|
(assert (= 1 (Array.length &a))))))
|
|
|
|
(defn main []
|
|
(do
|
|
(IO.println "Grow and shrink")
|
|
(bench grow-and-shrink)))
|