flan/spike/x86/bench/b1-calls.flan

21 lines
759 B
Plaintext

;;;; A hot loop that does nothing but call.
;;;;
;;;; The suspected cost is the guard this backend emits after every call --
;;;; and, in a dev build, the load of the indirection cell before it. Neither
;;;; is visible in the corpus, where a program's whole run is process startup.
;;;; Here the call is the program: the body is one add, so whatever separates
;;;; this from LLVM at -O0 is the call sequence and not the arithmetic.
;;;;
;;;; Not in spike/x86 proper, where survey.sh would pick it up: the survey's
;;;; counts are quoted in three handoffs and a benchmark is not a case.
(defn step [a i64 b i64] i64
(+ a b))
(defn main [] i32
(let [acc (i64 0)]
(dotimes [i 20000000]
(set acc (step acc 1)))
(print acc) (println ""))
0)