;;;; A hot loop that does nothing but index a bounds-checked array. ;;;; ;;;; The suspected cost is three frame temporaries per check. This one has an ;;;; A/B that the others do not: --no-bounds-checks builds the same program ;;;; with the check gone, on both sides, so the difference between the two ;;;; x86 numbers is the check and nothing else, and the same difference on ;;;; the LLVM side says what the check costs when a compiler is allowed to ;;;; hoist it out of the loop. (defvar xs [1024 i32]) (defn main [] i32 (dotimes [i 1024] (set (at xs i) i)) (let [acc (i64 0)] (dotimes [r 20000] (dotimes [i 1024] (set acc (+ acc (i64 (at xs i)))))) (print acc) (println "")) 0)