Thanks for the replies guys. Both solutions outperform the original.
The one using unchecked operations is about 60x faster, which is the
kind of performance I was hoping for. It's good to see that Clojure
has the capacity to do things very quickly. I just need to learn all
the tricks to make it d
kedu Travis,
(defn base26 [ n]
(let [seed-string ""
s (new StringBuilder seed-string)]
(loop [ pos (- (count seed-string) 1)
x n]
(if (and (> pos 0)(> x 0))
(do (. s setCharAt pos (char (+ (int \a) (mod x 26
(recur (- pos 1) (/ x 26)
(. s
On Jun 14, 7:00 pm, tmountain wrote:
> I've been playing around with rewriting some Java code in Clojure and
> did some simple benchmarking in the process. In this case, there's a
> huge disparity in the performance numbers between the two languages,
> and I'm wondering what the cause may be. T
I've been playing around with rewriting some Java code in Clojure and
did some simple benchmarking in the process. In this case, there's a
huge disparity in the performance numbers between the two languages,
and I'm wondering what the cause may be. The program rotates a string
from "", "aaab",