Permalink
Browse files

str macro should call str/1 function directly, added str benchmark

  • Loading branch information...
thheller authored and swannodette committed Dec 22, 2016
1 parent 96493c7 commit cb66c277fc869ab9a5892cfb9ce6d1d0121d3dc7
Showing with 10 additions and 1 deletion.
  1. +9 −0 benchmark/cljs/benchmark_runner.cljs
  2. +1 −1 src/main/clojure/cljs/core.cljc
@@ -388,3 +388,12 @@
(recur xs)
x))
10)
+
+(println "\n")
+(println ";;; str")
+(simple-benchmark [] (str 1) 1000000)
+(simple-benchmark [] (str nil) 1000000)
+(simple-benchmark [] (str "1") 1000000)
+(simple-benchmark [] (str "1" "2") 1000000)
+(simple-benchmark [] (str "1" "2" "3") 1000000)
+(println)
@@ -806,7 +806,7 @@
(core/inc (core/quot c 32)))))
(core/defmacro str [& xs]
- (core/let [strs (core/->> (repeat (count xs) "cljs.core.str(~{})")
+ (core/let [strs (core/->> (repeat (count xs) "cljs.core.str.cljs$core$IFn$_invoke$arity$1(~{})")
(interpose ",")
(apply core/str))]
(list* 'js* (core/str "[" strs "].join('')") xs)))

0 comments on commit cb66c27

Please sign in to comment.