Skip to content

Commit c8d4491

Browse files
committed
add indirect keyword and symbol invoke benchmark, keywords (JS
Strings) are nearly >7X slower under v8
1 parent 991ceeb commit c8d4491

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

benchmark/cljs/benchmark_runner.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@
158158
(simple-benchmark [coll {'foo 1 'bar 2}] (-lookup coll 'foo nil) 1000000)
159159
(simple-benchmark [coll {:foo 1 :bar 2}] (:foo coll) 1000000)
160160
(simple-benchmark [coll {'foo 1 'bar 2}] ('foo coll) 1000000)
161+
(let [kw :foo
162+
sym 'foo]
163+
(simple-benchmark [coll {:foo 1 :bar 2}] (kw coll) 1000000)
164+
(simple-benchmark [coll {'foo 1 'bar 2}] (sym coll) 1000000))
161165
(defrecord Foo [bar baz])
162166
(simple-benchmark [coll (Foo. 1 2)] (:bar coll) 1000000)
163167
(simple-benchmark [coll {:foo 1 :bar 2}] (assoc coll :baz 3) 100000)
@@ -176,6 +180,8 @@
176180
(recur (inc i) (assoc m 'foo 2))
177181
m))
178182
1)
183+
(println)
184+
179185
(println ";;; persistent hash maps")
180186
(def pmap (into cljs.core.PersistentHashMap/EMPTY
181187
[[:a 0] [:b 1] [:c 2] [:d 3] [:e 4] [:f 5] [:g 6] [:h 7]

0 commit comments

Comments
 (0)