Js_of_ocaml binary size over differents versions

Terry Pratchett died the 03/12/2015. As a tribute, I had published a small application which generate a ook program, in order to sent him a message.

This is the oldest code I’ve keeped both the source and the compiled version (with js_of_ocaml) and the js binary starts with this header :

// Generated by js_of_ocaml 2.5

Does it still compile today ? No. At this date, js_of_ocaml relied on camlp4, and a syntax change into the ppx world broke the code. This is however easy to fix :

diff library.ml library_402.ml 
1d0
< open Js_of_ocaml
11c10
<   global##.converter :=
---
>   global##converter<-

With this little change, I compiled my code with the latest ocaml and js_of_ocaml code. Surprisingly the binary size grew up, from 12k to 75k!

I have created a gist with the code and the results with differents versions. I’m interrested if you have any feedback.This does not seems related to OCaml compiler itself, but with js_of_ocaml (between v3.0 and v3.5): did I miss a compile flag? Is there any other feedback from maintaining the same code over years and comparing the results ?

2 Likes

Most likely related to Blog post: Js_of_ocaml, a bundle size study - #3 by hhugo

Thanks ! I didn’t saw this thread, this is very interresting !