Zokka-Dev / zokka-compiler

Fork of compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
81 stars 0 forks source link

Don't run string sanitization when outputting pure JS file #10

Open changlinli opened 6 months ago

changlinli commented 6 months ago

Quick Summary: Currently we to fix https://github.com/elm-lang/elm-make/issues/174, which is tracked from https://github.com/elm/compiler/issues/1377, we are sanitizing string literals according to https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements. But this sanitization is unnecessary if we're outputting a *.js file instead of a *.html file, since those restrictions exist only to get around the HTML parser.

Should measure what performance effect this restriction has and see whether we should allow codegen to know whether it's generating an HTML file or a JS file.

changlinli commented 6 months ago

After some preliminary benchmarking, the perf overhead actually seems quite small, but as I go for perf optimization, probably still worth cutting down on.