Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clojurescript advanced compilation - size

I am new to clojurescript.

Is it normal to have a javascript file of "77 KB" after advanced compilation?

I have one clojurescript file:

I am using leinigen: lein cljsbuild once

(ns my-staff.core)
 (defn ^:export main []
   (.write js/document "<p>Hello from my_staff.core.main()</p>")) 

(defproject my-staff "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/clojurescript "0.0-1586"]]
  :source-paths ["src-clj"]; source path for clojure
  :plugins [[lein-cljsbuild "0.3.0"]]
  :cljsbuild {
     :builds [{
          :source-paths ["src-cljs"]
          :compiler {
          :output-to "public/javascripts/main.js"
          :optimizations :advanced
          :pretty-print false}}]})
like image 647
alai Avatar asked Feb 25 '13 08:02

alai


1 Answers

Yes, that's normal. The Google Closure compiler has trouble optimizing some of the code that the clojurescript compiler currently emits. This is expected to improve over time. Check CLJS-257 for progress.

like image 179
mtyaka Avatar answered Sep 22 '22 07:09

mtyaka