News for hackers. Stuff that matters.
Re:The Emterpreter: Run asm.js code before it can be parsed by TazeTSchnitzel on Monday February 23, 2015 @05:43PM (#9097536)
> 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.

Re:The Emterpreter: Run asm.js code before it can be parsed by hetman on Monday February 23, 2015 @05:48PM (#9097571)
Except you gain better startup speed which was kind of the premise of this article.
Re:The Emterpreter: Run asm.js code before it can be parsed by TazeTSchnitzel on Monday February 23, 2015 @05:51PM (#9097582)
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.

Re:The Emterpreter: Run asm.js code before it can be parsed by zimbatm on Monday February 23, 2015 @06:46PM (#9097817)
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.
Re:The Emterpreter: Run asm.js code before it can be parsed by hetman on Monday February 23, 2015 @08:37PM (#9098242)
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.
Re:The Emterpreter: Run asm.js code before it can be parsed by esailija on Tuesday February 24, 2015 @07:32AM (#9100134)
With proper bytecode you would have to do bytecode verification so no.
Re:The Emterpreter: Run asm.js code before it can be parsed by Morgawr on Tuesday February 24, 2015 @06:49AM (#9100018)
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?

Re:The Emterpreter: Run asm.js code before it can be parsed by beagle3 on Tuesday February 24, 2015 @11:04AM (#9101403)
> 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?