Commit f9a6856
authored
Experimental Lite Mode (#265)
new code-size compiler flags: :lite-mode, :elide-to-string
:lite-mode emits updated variants of the original copy-on-write data
structures from 2011. Notably, in `:lite-mode` chunked-seqs are not
supported as they pull in a significant amount of code, which defeats
the purpose of the new flags. Also while the transient interfaces are
implemented on the copy-on-write data structures, they do not actually
provide a fast path. This is not by design, but simply a practical
scoping of effort as the work done here is already considerable.
The other serious code-size issue are `.toString` impls. There are
many interesting smaller programs that simply do not need the
convenient `.toString` invoking the ClojureScript recursive printing
machinery. By combining `:lite-mode true` with `:elide-to-string true`
the emitted code is cut in half or more for simpler programs.
For a rough idea of the space-savings, a hash-map literal is ~6K after
advanced compilation with the new flags and brotli
compression. ClojureScript 1.12.42 is ~17K brotli for the same program.
The following expression
(.log js/console
(->> (map inc (range 10))
(filter even?)
(partition 2)
(drop 1)
(mapcat identity)
into-array))
Is ~6K after advanced compilation + brotli compression. ClojureScript
is 1.12.42 is ~19K.
For users that want the full expressiveness of the Clojure APIs and
the interactivity of the REPL for smaller and/or simpler projects, but
don't need every last bit of performance, these two flags should lead
to compact artifacts.1 parent ddf3cfe commit f9a6856
File tree
20 files changed
+1391
-279
lines changed- .github/workflows
- resources
- src
- main
- cljs/cljs
- analyzer/passes
- spec
- clojure/cljs
- test
- cljs_build/trivial
- cljs
- cljs
- clojure/cljs
20 files changed
+1391
-279
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
62 | 119 | | |
63 | 120 | | |
64 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments