LexiFi / ocaml-vdom

Elm architecture and (V)DOM for OCaml
MIT License
197 stars 13 forks source link

Comparison with bucklescript-tea #28

Closed joprice closed 4 years ago

joprice commented 4 years ago

The readme mentions targeting bucklescript, and there is an existing vdom implementation for bucklescript: https://github.com/OvermindDL1/bucklescript-tea. As its readme states, it tries to remain close to the Elm api to allow easily transferring concepts from Elm tutorials and converting code from Elm to Ocaml. Not sure if you are aware of that library, but it would be interesting to compare the two libraries with regard to the vdom api design, performance, etc.

OvermindDL1 commented 4 years ago

Mine was a minimum viable code necessary to fulfill the elm API to ease porting to identify, a proper implementation could definitely do it better! I'd imagine this would be such an implementation.

alainfrisch commented 4 years ago

To be clear, ocaml-vdom currently doesn't work with Bucklescript (and we have no immediate plan to work on it), but it goes through gen_js_api for binding with JS, and I believe someone familiar with Bucklescript should be able to tweak gen_js_api to produce Bucklescript-compatible glue code quite easily, thus enabling ocaml-vdom to work with Bucklescript indeed.

Also, ocaml-vdom takes inspiration from Elm, but doesn't try to remain as close as possible from its API. Its definitely targeted more to the typical OCaml programmer and doesn't try to help porting existing Elm code, nor to explicitly attract JS or Elm developers.

joprice commented 4 years ago

Thanks for the info! I'm experimenting with jsoo, and was going to try porting bucklescript-tea over to it, until I stumbled upon your library, so I'm trying to figure out where to put my efforts.

Have you done any performance testing of the library as well? I think @OvermindDL1 tested his and found it fared well against elm and react, but not sure if that's a repeatable test. Maybe I can try to set up a similar test. I'm curious to find out whether there is a difference in performance between bucklescript and jsoo's js output for an application like this, or if either library has insights for the other that could improve it.

alainfrisch commented 4 years ago

We use the library in an industrial setting, with rather complex UIs (but not really "huge"), and never worried about performance, but no performance testing per-se has been carried.

See also https://github.com/LexiFi/ocaml-vdom/issues/12

OvermindDL1 commented 4 years ago

In general a functional VDom that assumes immutable updates will be faster than anything react or so can possible do unless it's made exceptionally poorly, I doubt performance would be an issue at all in other words with this.