Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use `into []` instead of `vec`

  • Loading branch information...
commit cf7dda81a22f4c9c1fe64c699ca17e7deed61db4 1 parent dcc6802
@Bronsa Bronsa authored
View
4 src/main/clojure/clojure/tools/analyzer.clj
@@ -449,7 +449,7 @@
{:op :letfn
:env env
:form form
- :bindings (vec (vals binds)) ;; order is irrelevant
+ :bindings (into [] (vals binds)) ;; order is irrelevant
:body body
:children [:bindings :body]})))
@@ -545,7 +545,7 @@
(-source-info form env)
(-source-info params env)))))
(let [variadic? (boolean (some '#{&} params))
- params-names (if variadic? (vec (remove '#{&} params)) params)
+ params-names (if variadic? (into [] (remove '#{&} params)) params)
env (dissoc env :local)
arity (count params-names)
params-expr (mapv (fn [name id]
View
2  src/main/clojure/clojure/tools/analyzer/ast.clj
@@ -47,7 +47,7 @@
(defn rseqv [v]
"Same as (comp vec rseq)"
- (vec (rseq v)))
+ (into [] (rseq v)))
(defmulti -update-children (fn [ast f] (:op ast)))
(defmulti -update-children-r (fn [ast f] (:op ast)))
View
4 src/main/clojure/clojure/tools/analyzer/passes/elide_meta.clj
@@ -22,8 +22,8 @@
(:keys meta) (:vals meta))]
(assoc meta
:form new-meta
- :keys (vec (keep first meta-map))
- :vals (vec (keep second meta-map))))))
+ :keys (into [] (keep first meta-map))
+ :vals (into [] (keep second meta-map))))))
(defn -elide-meta
[{:keys [op meta expr env] :as ast}]

3 comments on commit cf7dda8

@ghadishayban

Only bringing this up because I've done this exact thing, but this may be premature optimization. IMHO the benchmarks on CLJ-1192 and CLJ-1384 are incomplete, and I've been cautioned before about getting those right first. Wouldn't it be better to trust that #'vec impl can and will improve (possibly on top of reduce)?

@Bronsa
Collaborator
@ghadishayban

:thumbsup: for measuring a real app.

Please sign in to comment.
Something went wrong with that request. Please try again.