Fork me on GitHub
#clojurescript
<
2018-12-23
>
Christian Johansen22:12:27

Question about advanced optimizations:

Christian Johansen22:12:31

(ns test.core
  (:require [cljs.reader :as reader]))

(defn method1 []
  (js/console.log "Hello"))

(defn method2 []
  (js/console.log (reader/read-string "Hello")))

(method1)

Christian Johansen22:12:01

this code compiles to 125k, but I had expected it to strip out cljs.reader. Is my expectation wrong?

Christian Johansen22:12:22

If I comment out the require and method2 (which isn't used), this compiles down to 5k

mfikes23:12:46

@christian767 It could very well be that there is something inherently not DCE-friendly in cljs.reader. The same thing occurs with cljs.pprint. See https://dev.clojure.org/jira/browse/CLJS-2885