1. 14
  1. 7

    It’s worth noting that probably the main reason both Asturius and and GHCJS have fallen into a bitrotted state is that GHC 9.6 is aiming to have native backends for both WebAssembly and Javascript, which should replace both these projects. Having it in GHC proper should also mean that it gets maintained as a production platform. I’d be very interested to see this post updated once 9.6 has been released - I believe the native WASM backend reached a pretty important milestone just last week.

    1. 4

      I remember running into this a long while ago. I wrote 2 versions in Roc compiled to wasm. It was significantly faster than any of the current implementations. The Roc version took approximately 0.1 ms to run. So about 10x faster than the JavaScript version. That said, performance.now() which I used for timing only measure to about 0.1 ms on my browser. So sometimes the roc function measures as taking zero time. Though on average, it was just under 0.1 ms.

      This is the actual core of the Roc code (though it probably needs to be updated to compile): https://github.com/bhansconnect/functional-mos6502-web-performance/blob/master/implementations/roc-effectful/emulator.roc

      Might have to revive this to put exact stats on this thread.

      1. 2

        I’m slightly irked by this comparing generated code size of non-JS code to plain JS with (afaict) all formatting and human legibility. This cuts both ways of course: it likely leaves the pure JS larger than it needs to be, and also makes the implementation size vastly larger for the FLs.

        While size on the wire is important (looking at you GHC), part of the reason for using an FL is that it should have less human written code.

        Currently what is shown is that FLs require more bytes over the wire and then run slower which isn’t exactly a good sales pitch :)

        1. 2

          Great to see how well ReScript does here.

          1. 1

            Elm is presumably not on the list since it compiles to JS and would therefore be more-or-less indistinguishable from the plain JS baseline?

            1. 3

              All of these options compile to JS.

              1. 1

                My bad. I thought everything on that list but Reason compiled to wasm. The Elm omission seems rather glaring then, doesn’t it?

                1. 2

                  There’s no ClojureScript, Scala.js, F#, derw, js_of_ocaml, LunarML, Gleam, and many other FP options either.

              2. 2

                It might do some tricks to get better optimization and be a bit faster, but that can be hit or miss depending on the specific code. I’m not sure why it isn’t included. Presumably the author didn’t know about it?