gren-lang / compiler

Compiler for the Gren programming language
https://gren-lang.org
Other
342 stars 21 forks source link

Are optimizations working? #229

Closed ii8 closed 11 months ago

ii8 commented 11 months ago

Using the --optimize flag doesn't appear to make any difference to the output.

robinheghan commented 11 months ago

--optimize mostly mangles property names in records. Like

{ name: "String
, age: 10
}

Will instead be compiled to

{ a:"String", b:10 }

The idea is that it performs optimizations that would be difficult for a minifier to do.

I could be wrong, but I'm pretty certain this works.

ii8 commented 11 months ago

What I mean is, if I have a simple example Main.gren with a few records with long names And I run

gren make --output=a.js src/Main.gren
gren make --output=b.js --optimize src/Main.gren
diff a.js b.js

It reports there is no difference. Is that expected? What does optimize do in that case?

nvm, it works now, I'm not sure what I did differently a minute ago.