mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
26 lines
462 B
Plaintext
26 lines
462 B
Plaintext
(load "Bench.carp")
|
|
(use Bench)
|
|
(Debug.sanitize-addresses)
|
|
(use Array)
|
|
|
|
(def n 1000)
|
|
|
|
|
|
(defn some-subarray []
|
|
(let-do [a (replicate n &1)
|
|
b (slice &a 0 (/ n 2))]
|
|
(assert (= (/ n 2) (length &b)))))
|
|
|
|
(defn perform-bench [new-n]
|
|
(do
|
|
(set! n new-n)
|
|
(println* "\nTaking sub-array of array with length " n)
|
|
(bench some-subarray)))
|
|
|
|
(defn main []
|
|
(do
|
|
(perform-bench 1000)
|
|
(perform-bench 10000)
|
|
(perform-bench 100000)
|
|
))
|