CMS in the Old Days

Elm 0.19, its Parser, and MiniLatex

The long-awaited 0.19 version of the Elm compiler has just been released. What does it do differently? First off, compiling code is MUCH faster. Here is how long it took to compile my kNode project (5k loc) after touching all 29 modules:

real 0m0.958s
user 0m0.651s
sys 0m0.158s

In normal development, only a few files are changed at a time, and compilation speeds are on the eyeblink timescale, more precisely, about 500ms.

Second, asset sizes are much smaller. In the case of kNode, the Main.min.js.gzip file that contains the entire application is just 58k. In the 0.19 announcement, Evan Czaplicki talks about what makes this possible. In a word, function-level granularity. Read all about it!

Third, the amazing elm/parseris fast, fast, fast! I used it to construct the MiniLatex parser-renderer — a pipeline that parses LaTeX source text into an abstract syntax tree (AST) and then turns the AST into HTML. The new parser makes it possible to live-render of LaTeX into HTML: changes to a MiniLatex document are rendered on the eyeblink scale. This is a bold claim, so check it out for yourself using the MiniLatex Live demo app.

The wait for version 0.19 of the Elm compiler was well worth it. An amazing amount of thought and plain hard work went into it, and the results speak for themselves. In the case of my project, the vastly improved parser performance was a game changer. Viva the --optimize flag!

About MiniLatex Live. Notice how long the rendered text took to display. The app loaded, then parsed and rendered the source text in the left-hand window and, finally, rendered in the right hand window. If all this took more than an eyeblink, I will buy you a beer. If you want to see what happens with a longer document, take a look at Wave Packets on kNode. Alternatively, go to kNode.io., type “wave” in the search box, and then press Ctrl-Enter (Ctrl-Return). Edits to documents are always rendered faster than initial rendering of an entire document.

Technical note. The MiniLatex library, 3.7k loc, is compiled separately from the kNode app. kNode talks to a 3k loc Elixir backend which serves up the LaTeX files, manages user authentication, etc. The kNode app also talks to an Nginx web server equipped with PHP so as to convert MiniLatex files to PDF for purposes of printing.

Some technical notes on MiniLatex: Towards LaTeX in the Browser

.