[OCaml] High Intensity Training Online
perf shrink the client bundle from 3.5 MB to 1.1 MB
The dev profile embedded an inline source map in the client script and kept the output readable, so every script-enabled visitor downloaded 3.5 MB for about 550 lines of OCaml. That is a direct cost of the progressive enhancement. Drop the embedded source map, the pretty printing, and the debug info. The bundle falls to 1.1 MB with no change to behaviour. The remaining size is the js_of_ocaml and Lwt runtime; the optimisation level is left to the build profile, since this dune version routes explicit --opt to the runtime builder, which rejects it.
lib/web/dune
@@ -1,7 +1,17 @@
1
Added:
; The browser client. The dev profile embeds an inline source map and keeps the
2
Added:
; output readable, which multiplies the bundle several times over. Every
3
Added:
; script-enabled visitor downloads this file, so its size is a direct cost of
4
Added:
; the progressive enhancement. Drop the embedded source map, the pretty
5
Added:
; printing, and the debug info. Optimisation level is left to the profile.
6
Added:
1
7
(executable
2
8
(name workout_client)
3
9
(modules workout_client)
4
10
(modes js)
11
Added:
(js_of_ocaml
12
Added:
(sourcemap no)
13
Added:
(flags
14
Added:
(--disable pretty --disable debuginfo)))
5
15
(preprocess
6
16
(pps js_of_ocaml-ppx))
7
17
(libraries js_of_ocaml js_of_ocaml-lwt lwt))