summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-06-24 10:58:36 -0400
committerRich Hickey <richhickey@gmail.com>2009-06-24 10:58:36 -0400
commit72de405ca6454ecf5d76a170c7ac09900af5539f (patch)
tree4290782aced8b4222b8ea3c907e48f475a5a99d4
parent145fea489ea837e2dfa1af8fadb99da88c51c79f (diff)
perf tweaks in map/filter/reduce
-rw-r--r--src/clj/clojure/core.clj10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 2e4bff94..141ec2d6 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -559,7 +559,7 @@
{:inline (fn [x] `(. clojure.lang.Numbers (inc ~x)))}
[x] (. clojure.lang.Numbers (inc x)))
-(defn chunk-buffer [capacity]
+(defn #^clojure.lang.ChunkBuffer chunk-buffer [capacity]
(clojure.lang.ChunkBuffer. capacity))
(defn chunk-append [#^clojure.lang.ChunkBuffer b x]
@@ -608,7 +608,7 @@
(let [c (chunk-first s)]
(loop [val val i (int 0)]
(if (< i (count c))
- (recur (f val (nth c i)) (inc i))
+ (recur (f val (.nth c i)) (inc i))
val)))
(chunk-next s))
(recur f (f val (first s)) (next s)))
@@ -1558,7 +1558,7 @@
size (int (count c))
b (chunk-buffer size)]
(dotimes [i size]
- (chunk-append b (f (nth c i))))
+ (chunk-append b (f (.nth c i))))
(chunk-cons (chunk b) (map f (chunk-rest s))))
(cons (f (first s)) (map f (rest s)))))))
([f c1 c2]
@@ -1596,8 +1596,8 @@
size (count c)
b (chunk-buffer size)]
(dotimes [i size]
- (when (pred (nth c i))
- (chunk-append b (nth c i))))
+ (when (pred (.nth c i))
+ (chunk-append b (.nth c i))))
(chunk-cons (chunk b) (filter pred (chunk-rest s))))
(let [f (first s) r (rest s)]
(if (pred f)