Skip to content

Instantly share code, notes, and snippets.

@nbeloglazov
Created March 12, 2016 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbeloglazov/0bf163fb62fa4b61d446 to your computer and use it in GitHub Desktop.
Save nbeloglazov/0bf163fb62fa4b61d446 to your computer and use it in GitHub Desktop.
From 3e49631e23f20c784fe70fc0d76bb3a58c4b8da6 Mon Sep 17 00:00:00 2001
From: Nikita Beloglazov <nikelandjelo@gmail.com>
Date: Sat, 12 Mar 2016 11:35:10 -0800
Subject: [PATCH] Optimize dump. Reduces size of optimizations SIMPLE binary
from 6.4M to 2.7M
---
src/main/cljs/cljs/js.clj | 2 +-
src/main/cljs/cljs/js.cljs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/cljs/cljs/js.clj b/src/main/cljs/cljs/js.clj
index 1c4a51a..f056f5a 100644
--- a/src/main/cljs/cljs/js.clj
+++ b/src/main/cljs/cljs/js.clj
@@ -20,5 +20,5 @@
(defmacro dump-core []
(let [state @env/*compiler*]
(if-not (false? (get-in state [:options :dump-core]))
- `(quote ~(get-in state [::ana/namespaces 'cljs.core]))
+ (pr-str (get-in state [::ana/namespaces 'cljs.core]))
`(hash-map))))
diff --git a/src/main/cljs/cljs/js.cljs b/src/main/cljs/cljs/js.cljs
index fecee1c..8dd5dbc 100644
--- a/src/main/cljs/cljs/js.cljs
+++ b/src/main/cljs/cljs/js.cljs
@@ -114,7 +114,7 @@
(swap!
(fn [state]
(-> state
- (assoc-in [::ana/namespaces 'cljs.core] (dump-core)))))))
+ (assoc-in [::ana/namespaces 'cljs.core] (r/read-string (dump-core))))))))
([init]
(doto (empty-state) (swap! init))))
2.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment