[Haskell-cafe] ghci & ghc -> JS (Emscripten)
Luite Stegeman
stegeman at gmail.com
Wed Jul 3 17:11:23 CEST 2013
> Similarly I would expect that generating any sort of sensible Javascript
> would require something fairly tightly tied to GHC; otherwise the output's
> going to have horrible performance because it's not going to understand the
> input and will fall back to the slowest but most general translation. (If
> it even has such a fallback, instead of simply failing on code that it
> doesn't recognize.)
>
>
Emscripten produces a limited subset of JavaScript (asm.js), and Firefox
has an optimizer specifically for that. It could result in good
performance, but the CPS transformed code is still a problem indeed, so
it's unclear if GHC generated code would work at all.
Asm.js is really limited, it's like a far less convenient LLVM without
modern instructions in JavaScript syntax. You can't use objects, everything
is stored in a global heap array.
Interestingly, Firefox performs far worse than Chrome and Safari on the
current GHCJS code, probably because their garbage collector is rather poor
(non-generational), and Haskell code produces lots of short-lived immutable
objects.
luite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130703/d046ada6/attachment.htm>
More information about the Haskell-Cafe
mailing list