Permalink
Browse files

Merge branch 'master' into source-map

  • Loading branch information...
2 parents 51facc2 + e1e14cb commit 3e5cbdb824585b56f45f9e988bdf115adc082f12 @swannodette swannodette committed Mar 1, 2013
@@ -8,6 +8,10 @@
(simple-benchmark [x 1] (identity x) 1000000)
+(println ";; symbol construction")
+(simple-benchmark [] (symbol 'foo) 1000000)
+(println)
+
(println ";; array-reduce & ci-reduce")
(def arr (let [arr (array)]
(dotimes [i 1000000]
@@ -45,6 +49,7 @@
(simple-benchmark [coll [1 2 3]] (conj coll 4) 1000000)
(simple-benchmark [coll [1 2 3]] (-conj coll 4) 1000000)
(simple-benchmark [coll [1 2 3]] (seq coll) 1000000)
+(simple-benchmark [coll [1 2 3]] (-seq coll) 1000000)
(simple-benchmark [coll (seq [1 2 3])] (first coll) 1000000)
(simple-benchmark [coll (seq [1 2 3])] (-first coll) 1000000)
(simple-benchmark [coll (seq [1 2 3])] (rest coll) 1000000)
@@ -59,6 +64,13 @@
(simple-benchmark [coll (reduce conj [] (range (+ 32768 33)))] (pop coll) 100000)
(println)
+(println ";;; chunked seqs")
+(let [v (seq (into [] (range 64)))]
+ (simple-benchmark [] (-first v) 1000000)
+ (simple-benchmark [] (-next v) 1000000)
+ (simple-benchmark [] (-rest v) 1000000))
+(println)
+
(println ";;; transients")
(print "transient vector, conj! 1000000 items")
(time
@@ -76,22 +88,60 @@
(println ";; apply")
(simple-benchmark [coll (into [] (range 1000000))] (apply + coll) 1)
+(simple-benchmark [] (list 1 2 3 4 5) 1000000)
+(simple-benchmark [xs (array-seq (array 1 2 3 4 5))] (apply list xs) 1000000)
+(simple-benchmark [xs (list 1 2 3 4 5)] (apply list xs) 1000000)
+(simple-benchmark [xs [1 2 3 4 5]] (apply list xs) 1000000)
+(println)
+
+(println ";; update-in")
+(simple-benchmark [coll {:foo 1} ks [:foo]] (update-in coll ks inc) 1000000)
+(simple-benchmark [coll (array-map :foo 1) ks [:foo]] (update-in coll ks inc) 1000000)
+(println)
+
+(println ";;; obj-map")
+(simple-benchmark [coll (obj-map)] (assoc coll :foo :bar) 1000000)
+(simple-benchmark [coll (obj-map :foo :bar)] (-lookup coll :foo) 1000000)
+(simple-benchmark [coll (obj-map :foo :bar)] (assoc coll :baz :woz) 1000000)
+(simple-benchmark [coll (obj-map :foo :bar :baz :woz)] (-lookup coll :baz) 1000000)
+(simple-benchmark [coll (obj-map :foo :bar :baz :woz :lol :rofl)] (-lookup coll :lol) 1000000)
+(println)
+
+(println ";;; array-map")
+(simple-benchmark [] {[1] true [2] true [3] true} 1000000)
+(simple-benchmark [coll (array-map)] (assoc coll :foo :bar) 1000000)
+(simple-benchmark [coll (array-map :foo :bar)] (-lookup coll :foo) 1000000)
+(simple-benchmark [coll (array-map :foo :bar)] (assoc coll :baz :woz) 1000000)
+(simple-benchmark [coll (array-map :foo :bar :baz :woz)] (-lookup coll :baz) 1000000)
+(simple-benchmark [coll (array-map :foo :bar :baz :woz :lol :rofl)] (-lookup coll :lol) 1000000)
(println)
+(def data-atom (atom {:x 0}))
(println ";;; map / record ops")
(simple-benchmark [coll {:foo 1 :bar 2}] (get coll :foo) 1000000)
+(simple-benchmark [coll {'foo 1 'bar 2}] (get coll 'foo) 1000000)
(simple-benchmark [coll {:foo 1 :bar 2}] (-lookup coll :foo nil) 1000000)
+(simple-benchmark [coll {'foo 1 'bar 2}] (-lookup coll 'foo nil) 1000000)
(simple-benchmark [coll {:foo 1 :bar 2}] (:foo coll) 1000000)
+(simple-benchmark [coll {'foo 1 'bar 2}] ('foo coll) 1000000)
(defrecord Foo [bar baz])
(simple-benchmark [coll (Foo. 1 2)] (:bar coll) 1000000)
(simple-benchmark [coll {:foo 1 :bar 2}] (assoc coll :baz 3) 100000)
+(simple-benchmark [coll {'foo 1 'bar 2}] (assoc coll 'baz 3) 100000)
(simple-benchmark [coll {:foo 1 :bar 2}] (assoc coll :foo 2) 100000)
+(simple-benchmark [coll {'foo 1 'bar 2}] (assoc coll 'foo 2) 100000)
(simple-benchmark [coll {:foo 1 :bar 2}]
(loop [i 0 m coll]
(if (< i 100000)
(recur (inc i) (assoc m :foo 2))
m))
1)
+(simple-benchmark [coll {'foo 1 'bar 2}]
+ (loop [i 0 m coll]
+ (if (< i 100000)
+ (recur (inc i) (assoc m 'foo 2))
+ m))
+ 1)
(println ";;; persistent hash maps")
(def pmap (into cljs.core.PersistentHashMap/EMPTY
[[:a 0] [:b 1] [:c 2] [:d 3] [:e 4] [:f 5] [:g 6] [:h 7]
@@ -121,9 +171,11 @@
(println)
(println ";;; set ops")
-(simple-benchmark [] #{} 100000)
-(simple-benchmark [] #{1 2 3} 100000)
-(simple-benchmark [coll #{1 2 3}] (conj coll 4) 100000)
+(simple-benchmark [] #{} 1000000)
+(simple-benchmark [] #{1 2 3} 1000000)
+(simple-benchmark [v [1 2 3]] (set v) 1000000)
+(simple-benchmark [] (hash-set 1 2 3) 1000000)
+(simple-benchmark [coll #{1 2 3}] (conj coll 4) 1000000)
(println)
(println ";;; seq ops")
View
@@ -109,30 +109,30 @@ does what?
* DONE bit-xor
* DONE boolean
* boolean-array
-* booleans
+* DONE booleans
* bound-fn
* bound-fn*
* bound?
* DONE butlast
-* TODO byte
+* DONE byte
* byte-array
-* bytes
+* DONE bytes
* DONE case
* cast
-* char
+* DONE char
* char-array
* char-escape-string
* char-name-string
* char?
-* chars
-* chunk
-* chunk-append
-* chunk-buffer
-* chunk-cons
-* chunk-first
-* chunk-next
-* chunk-rest
-* chunked-seq?
+* DONE chars
+* DONE chunk
+* DONE chunk-append
+* DONE chunk-buffer
+* DONE chunk-cons
+* DONE chunk-first
+* DONE chunk-next
+* DONE chunk-rest
+* DONE chunked-seq?
* class
* class?
* clear-agent-errors
@@ -197,9 +197,9 @@ For macros only, uses clojure.core version
* dosync
* DONE dotimes
* DONE doto
-* TODO double
+* DONE double
* DONE double-array
-* TODO doubles
+* DONE doubles
* DONE drop
* DONE drop-last
* DONE drop-while
@@ -232,18 +232,18 @@ macro currently expands into extend call
* find-var
* DONE first
* DONE flatten
-* float
+* DONE float
* float-array
* float?
-* floats
+* DONE floats
* flush
* DONE fn
* DONE fn?
* DONE fnext
* DONE fnil
* DONE for
* DONE force
-* format
+* DONE format
* DONE frequencies
* future
* future-call
@@ -278,14 +278,14 @@ macro currently expands into extend call
* DONE instance?
does what?
* DONE int
-* int-array
+* DONE int-array
* DONE integer?
* DONE interleave
* intern
* DONE interpose
* DONE into
* DONE into-array
-* ints
+* DONE ints
* io!
* DONE isa?
does what?
@@ -316,7 +316,7 @@ does what?
* locking
* DONE long
* DONE long-array
-* TODO longs
+* DONE longs
* DONE loop
* macroexpand
* macroexpand-1
@@ -477,12 +477,12 @@ as macro
* DONE set
* set-error-handler!
* set-error-mode!
-* set-validator!
+* DONE set-validator!
* DONE set?
-* short
+* DONE short
* short-array
-* shorts
-* TODO shuffle
+* DONE shorts
+* DONE shuffle
* shutdown-agents
* slurp
* DONE some
@@ -525,27 +525,27 @@ as macro
* DONE tree-seq
* DONE true?
* DONE type - returns JS constructor
-* TODO unchecked-add
-* TODO unchecked-add-int
-* TODO unchecked-byte
-* TODO unchecked-char
-* TODO unchecked-dec
-* TODO unchecked-dec-int
-* TODO unchecked-divide-int
-* TODO unchecked-double
-* TODO unchecked-float
-* TODO unchecked-inc
-* TODO unchecked-inc-int
-* TODO unchecked-int
-* TODO unchecked-long
-* TODO unchecked-multiply
-* TODO unchecked-multiply-int
-* TODO unchecked-negate
-* TODO unchecked-negate-int
-* TODO unchecked-remainder-int
-* TODO unchecked-short
-* TODO unchecked-subtract
-* TODO unchecked-subtract-int
+* DONE unchecked-add
+* DONE unchecked-add-int
+* DONE unchecked-byte
+* DONE unchecked-char
+* DONE unchecked-dec
+* DONE unchecked-dec-int
+* DONE unchecked-divide-int
+* DONE unchecked-double
+* DONE unchecked-float
+* DONE unchecked-inc
+* DONE unchecked-inc-int
+* DONE unchecked-int
+* DONE unchecked-long
+* DONE unchecked-multiply
+* DONE unchecked-multiply-int
+* DONE unchecked-negate
+* DONE unchecked-negate-int
+* DONE unchecked-remainder-int
+* DONE unchecked-short
+* DONE unchecked-subtract
+* DONE unchecked-subtract-int
* DONE underive
* unquote
* unquote-splicing
View
@@ -30,7 +30,7 @@
<dependency>
<groupId>org.clojure</groupId>
<artifactId>google-closure-library</artifactId>
- <version>0.0-2029</version>
+ <version>0.0-2029-2</version>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>
View
@@ -27,7 +27,7 @@ There are currently four steps in starting a ClojureScript REPL.
A browser-connected REPL works in much the same way as a normal REPL:
forms are read from the console, evaluated and return values are
-printed. A major and useful difference form normal REPL usage is that
+printed. A major and useful difference from normal REPL usage is that
all side-effects occur in the browser. You can show alerts, manipulate
the dom and interact with running applications.
View
@@ -186,12 +186,9 @@
lb (-> env :locals prefix)]
(if lb
{:name (symbol (str (:name lb) suffix))}
- (do
- (when confirm
- (confirm env prefix (symbol suffix)))
- (merge (get-in @namespaces [prefix :defs (symbol suffix)])
- {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
- :ns prefix}))))
+ (merge (get-in @namespaces [prefix :defs (symbol suffix)])
+ {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
+ :ns prefix})))
(get-in @namespaces [(-> env :ns :name) :uses sym])
(let [full-ns (get-in @namespaces [(-> env :ns :name) :uses sym])]
@@ -410,6 +407,8 @@
:column (get-col fld env)
:field true
:mutable (-> fld meta :mutable)
+ :unsynchronized-mutable (-> fld meta :unsynchronized-mutable)
+ :volatile-mutable (-> fld meta :volatile-mutable)
:tag (-> fld meta :tag)
:shadow (m fld)}))
locals fields)
@@ -585,7 +584,9 @@
(let [local (-> env :locals target)]
(assert (or (nil? local)
(and (:field local)
- (:mutable local)))
+ (or (:mutable local)
+ (:unsynchronized-mutable local)
+ (:volatile-mutable local))))
"Can't set! local var or non-mutable field"))
(analyze-symbol enve target))
@@ -935,12 +936,10 @@
(defn analyze-map
[env form name]
(let [expr-env (assoc env :context :expr)
- simple-keys? (every? #(or (string? %) (keyword? %))
- (keys form))
ks (disallowing-recur (vec (map #(analyze expr-env % name) (keys form))))
vs (disallowing-recur (vec (map #(analyze expr-env % name) (vals form))))]
(analyze-wrap-meta {:op :map :env env :form form
- :keys ks :vals vs :simple-keys? simple-keys?
+ :keys ks :vals vs
:children (vec (interleave ks vs))}
name)))
View
@@ -803,7 +803,7 @@
(defn add-dep-string
"Return a goog.addDependency string for an input."
[opts input]
- (letfn [(ns-list [coll] (when (seq coll) (apply str (interpose ", " (map #(str "'" (munge %) "'") coll)))))]
+ (letfn [(ns-list [coll] (when (seq coll) (apply str (interpose ", " (map #(str "'" (comp/munge %) "'") coll)))))]
(str "goog.addDependency(\""
(path-relative-to (io/file (output-directory opts) "goog/base.js") input)
"\", ["
Oops, something went wrong.

0 comments on commit 3e5cbdb

Please sign in to comment.