Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thats just stupid you can make good source to source compiler that compile to better make faster code then a normal dev would do.


Fine. Name one anything-to-JavaScript compiler that generates better, faster code than a "normal" developer would do.

I assume we have different interpretations of what's normal.


GWT


Have you ever read GWT-generated code? Have you ever debugged it?


yeah and i have been working with gwt for years. faster code is not maintainable code, which is precisely why a mechanical optimizer makes sense. You wouldn't try to work directly with your minified js would you? But you do minify it, because it is a better experience for your users.


Minifying the code does not optimize it in any way. It just makes it more compact (and less readable).

I am not sure we are talking about the same thing here. What we are talking here is you inputting Java (and the most readable Java code is not that readable to begin with) into utterly unreadable JavaScript that's also less efficient than what a human experienced in JavaScript would be able to write and larger than the minified version of whatever that experienced human would be able to write.


"Minifying the code does not optimize it in any way. It just makes it more compact (and less readable)."

The thing with JavaScript is that the initial time for loading and parsing a script in the browser counts as part of the performance. This is why every implementation (except for CL-JavaScript: http://svrg.net/CL-Javascript%200.10.05.html) hasn't moved to compilers but JITs instead. So minifying JS does have some performance benefit in that it reduces load and parse time.


Unless your JS parser is absurdly broken, ignoring whitespace should not be such a computationally intensive task. The improvements you see must derive mostly from the size reduction and download time improvement.

And no. Minification of JS would not count as code optimization in any self-respecting compsi course.


"Unless your JS parser is absurdly broken, ignoring whitespace should not be such a computationally intensive task."

It is because every character the parser reads is a loop iteration at best, a state machine transition at worst. Minification does more than just deleting whitespace - identifiers are shortened too.

"The improvements you see must derive mostly from the size reduction and download time improvement."

The former yes because more code fits in cache and you need less time to parse it, the latter no because gzip compression does a better job than minification.

"And no. Minification of JS would not count as code optimization in any self-respecting compsi course."

This is why you learn about compilers by writing them instead of taking courses.


Thanks for the laugh




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: