on master help sign in
Add note about directly creating builders during code gen
33f153eEvan Czaplicki
compiler/src/Generate/JavaScript/Builder.hs+13
@@ -28,6 +28,19 @@ import qualified Json.Encode as Json
28-- EXPRESSIONS
28-- EXPRESSIONS
29
29
30
30
31+-- NOTE: I tried making this create a B.Builder directly.
32+--
33+-- The hope was that it'd allocate less and speed things up, but it seemed
34+-- to be neutral for perf.
35+--
36+-- The downside is that Generate.JavaScript.Expression inspects the
37+-- structure of Expr and Stmt on some occassions to try to strip out
38+-- unnecessary closures. I think these closures are already avoided
39+-- by other logic in code gen these days, but I am not 100% certain.
40+--
41+-- For this to be worth it, I think it would be necessary to avoid
42+-- returning tuples when generating expressions.
43+--
31data Expr
44data Expr
32 = String Builder
45 = String Builder
33 | Float Builder
46 | Float Builder