From d41db9bbb8e3b7a3d9c6f7084b322c19d664ff54 Mon Sep 17 00:00:00 2001 From: Samuel Hammersberg Date: Sat, 4 Feb 2023 15:25:28 +0100 Subject: [PATCH] Added some more to the comment of `binExprToValues` --- src/Compiler/Compiler.hs | 2 ++ test/simple.sf | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Compiler.hs b/src/Compiler/Compiler.hs index cb09c2d..2afc66f 100644 --- a/src/Compiler/Compiler.hs +++ b/src/Compiler/Compiler.hs @@ -211,6 +211,8 @@ compile (Program prgE) = do binExprToValues e1 e2 = case (e1, e2) of -- instead of declaring variables for working on ints, -- we can directly pass them to their functions. + -- This optimization removes the need to declare + -- roughly 50% of variables (EInt i1, EInt i2) -> return (VInteger i1, VInteger i2) (EInt i, e) -> do go e diff --git a/test/simple.sf b/test/simple.sf index 0a35e27..bbd9312 100644 --- a/test/simple.sf +++ b/test/simple.sf @@ -2,4 +2,4 @@ -main = ((2 * (123 + 4214 % (1230)) - 1231) / 314) +main = ((2 * (123 + 4214 % (1230)) - 1231) / 2) * 412412