News for hackers. Stuff that matters.
Re:Experimental support for WebAssembly in V8 by vvanders on Tuesday March 15, 2016 @01:14PM (#11291207)
Native performance is only better in the cases where you can explicitly control memory layout & access. That's why asm.js runs so fast. You're explicitly translating C/C++ to arrays.

I don't really see how a js -> wasm compiler fundamentally changes things. You're still working in JS which has poor memory placement semantics.

Re:Experimental support for WebAssembly in V8 by xigency on Tuesday March 15, 2016 @05:34PM (#11293199)
WebAssembly allows for a stack and a linear area of memory. The job of the compiler is to determine memory placement.
Re:Experimental support for WebAssembly in V8 by vvanders on Tuesday March 15, 2016 @06:19PM (#11293464)
Argh, I see this keep coming up and it really needs to be put to rest.

Compilers don't know how to layout your data. They don't know how you'll access it or the traversal patterns. Your whiz-bang compiler isn't going to strip out class members and AoS from SoA because that's a fundamental data structure problem.

Compilers are great, they fold things down, inline and unroll loops. When it comes to memory placement they can't know your intent and it's up to you to lay out your data appropriately. They might do padding but anything else is going to have memory & complexity implications and they shouldn't make those decisions for you.

Re:Experimental support for WebAssembly in V8 by xigency on Wednesday March 16, 2016 @12:51AM (#11295096)
I don't know, you have a real mix of arguments here, as do most people. There's nothing a JIT does that an ahead of time compiler can't do without the burden of a larger footprint.

This is really an issue of backend optimization to "make things like asm.js."

For example, there are obvious examples of cases where a JavaScript object's properties and property types would be transparent to a compiler at compile time, with a complete graph of where those values would be stored and used. This would be stored in the WebAssembly stack, analogous to an asm.js fixed array.

The WebAssembly sandbox is designed to run code directly. The JIT is designed to build code to run directly in an iterative fashion. If system designers knows how software is expected to operate, they can make choices to instrument that process and also make software which is designed intelligently.

Java runs in a VM. Someone could write a just in time compiler for .java code that performs well. That's not a sufficient argument not to develop or continue to develop a javac compiler for byte code. Additionally, whether or not a language is designed to use GC doesn't mean there couldn't be research or design into avoiding or augmenting that situation for performance (in the way that a just-in-time compiler would relieve the situation). Nor reason not to build a platform and engineering methodology to deploy to two independent and cooperating runtime environments.

Neither Asm.js and emscripten or C are the end of all things. Neither is dynamicism.