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

> I actually really like the sound of this, not because of the stated benefits (though those are nice), but because it sounds like this would actually create a really good upgrade path to implementing a proper bytecode into browsers.

We already have a proper bytecode with several high-performance implementations that's supported on virtually every platform, which works as an excellent compilation target for both dynamic and static languages.

It's called JavaScript.

Now you might say JS is bloated! But that's only if it's not gzipped or minified.

Make a "proper bytecode" and you gain absolutely nothing except losing the wide support JS enjoys.



Except you gain better startup speed which was kind of the premise of this article.


True, that's maybe the only case where there's an improvement. But it's a one-time cost (the browser can cache the compiled version), and switching to bytecode is not necessarily the only way to improve performance.

For example, a JS parser specially optimised for asm.js.


Note that cache is not always a solution. Cache is a terrible answer for first-time user experience. A lot of stuff on the web is loaded outside of the cache too for various reasons. Caches gets flushed.


My suspicion is that it will never be possible to parse asm.js as quickly as bytecode simply because it is structurally different. However, a quick search does suggest there are still some improvements possible in Firefox to speed things up somewhat.


With proper bytecode you would have to do bytecode verification so no.


Javascript is as much of a bytecode for the web as Java is a bytecode for the JVM.

It is not. Where would we be if we could only execute Java on the JVM? Clojure and Scala transpiled into Java? Can you imagine how terrible that would be?


> Can you imagine how terrible that would be?

I can, and it won't be terrible at all. Compile times might suffer a little (but that's likely to be negligible with a good Java compiler - I think Jikes is now abandoned, but back in 2002 it was pretty much instantaneous even for huge files, unlike Sun's). I don't think you'd notice it on Scala, and likely also not in other JVM languages.

I've worked with Python extensions that compile indirectly through C, and I have no experience with Nim but it seems to do that very well and very quickly.

What exactly do you believe the problem would have been if Scala or Clojure generated Java rather than JVM bytecode?




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

Search: