mirror of
https://codeberg.org/setop/elm-scripting
synced 2025-11-08 21:49:57 +00:00
more exploration
This commit is contained in:
@@ -8,13 +8,14 @@ A tool to generate HTML code from Elm source in the terminal using [QuickJS](htt
|
||||
* do not patch elm compiler output
|
||||
* provide acceptable performances (500ms for a big script)
|
||||
|
||||
|
||||
# Design
|
||||
|
||||
QuickJS (Qjs) is a [JavaScript runtime](https://en.wikipedia.org/wiki/List_of_JavaScript_engines), similar to V8 or SpiderMonkey, but lighter and faster.
|
||||
|
||||
As any runtime, Qjs can interpret JavaScript code, but it is not a web browser. It has no concept of an HTML document.
|
||||
|
||||
To bridge this gap, we add a minimal [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) implementation.
|
||||
To bridge this gap, we add a minimal [DOM](https://dom.spec.whatwg.org/) implementation.
|
||||
|
||||
Next, we concatenate this with the Elm JavaScript output and an app launcher snippet, then ask Qjs to interpret all of it.
|
||||
|
||||
@@ -24,6 +25,8 @@ Next, we concatenate this with the Elm JavaScript output and an app launcher sni
|
||||
* Hence, no [TEA](https://guide.elm-lang.org/architecture/); the `main` function must return a static view
|
||||
* Hence, no Time, no Random, no Json Encoder/Decoder (!), no Http
|
||||
* Nodes can only have one parent (this should always be the case)
|
||||
* Does not scale well : creating thousands of Nodes consumes a [lot of RAM](#Performances)
|
||||
|
||||
|
||||
# Usage
|
||||
|
||||
@@ -51,6 +54,7 @@ Hello World!
|
||||
|
||||
Acceptable for small scripts : 250ms on a modest x86_64 CPU and 64MB RAM for a 500 records into a table ; but is does not scale well as everything is loaded before processing ; no streaming contrary to the usual Unix way.
|
||||
|
||||
Generate 500k "li" loop took 17s and 900MB RAM.
|
||||
|
||||
|
||||
# Prior Work
|
||||
|
||||
Reference in New Issue
Block a user