by niggler · 13y ago · 0 comments
That's quite a bit of marketing here.
If NaCl is capable of reaching 1.1x performance while asm.js is at 2x (and it's not obvious to me within the confines of JS if you can actually do better than 1.5x), people would switch to a browser that supports NaCl (first the hardcore gamers, then the rest of us). Your argument only makes sense if asm.js and NaCl are at performance parity.
Note that people still write native iOS games, even though they could run everywhere if they did it in JS.
NaCl is not portable. asm.js is. You should compare PNaCl and asm.js.
> and it's not obvious to me within the confines of JS if you can actually do better than 1.5x
Why not? Is there a technical reason?
NaCL covers the only architectures that are likely to matter for phones and desktops for the next 5+ years: ARM and x86. In doing so, it can support NEON, SSE, and other architecture-specific hardware features that make substantial differences in performance.
So why shouldn't you compare NaCL to asm.js?
PNaCL is there to cover the case where we move past ARM and x86, in which case it provides the ability to target new architectures from existing deployed code. In an ideal universe, sites would serve fat x86/arm/pnacl binaries, optimized for a given client.
This is misleading. NaCl exists for both these platforms, but it doesn't support running the same code on each; NaCl lets you run native x86-compiled code on x86 and native ARM-compiled code on ARM.
> PNaCL is there to cover the case where we move past ARM and x86
That, too, but more importantly, it exists to let you run the same code (delivered as LLVM bitcode) on supported platforms, including x86 and ARM, instead of having to deliver separately-compiled code for each supported platform, as is the case for NaCl. That's what the "P" ("Portable") is about -- the code delivered runs on any PNaCl engine, unlike the case with NaCl where NaCl x86 code runs only on x86 and NaCl ARM code only on ARM.
You seem to have confused what PNaCl does now (experimental toolchain inside the NaCl SDK), and what the point of PNaCl is (to move the .pexe -> .nexe bitcode to native code piece of the toolchain from the SDK side into the client side, so all you deliver to the client is the platform-agnosti .pexe rather than the platform-specific .nexe.)
I didn't intend for this to be misleading -- the option to deploy code specific to each architecture is a benefit.
It means you can take advantage of the architecture's specific features (such as NEON and SSE).
But this is besides the point. The real question is what the web will look like even 10 years from now, with a large installed base of arch-specific binaries everywhere. I don't want to have to explain to my kids why their browser requires the equivalent of a PDP11 emulator installed to watch certain classic movies and games.
If there's a real MIPS resurgence outside of WiFi routers (eg, extremely cheap/low-quality tablets), then they can use PNaCL just fine until a native NaCL target is implemented.
However, given the market weight behind ARM and x86, this seems extraordinarily unlikely to be used outside of some extreme edge players. IIRC, MIPS support isn't even mainlined into Android.
The portability limitations have made Google wait for PNaCl before it flips the switch to authorize NaCl apps on the Web by default.
Note that I believe this choice is wise. I quote them:
> This will… avoid the spread of instruction set architecture dependent apps on the web.
Even the modest 32-bit integer multiplication is tricky (you only have 52-53 bits of mantissa). Mozilla proposed `Math.imul` extension.
goog.math.long provides a mechanism using an array, and emscripten does something similar (but can also use the hack if you are sure there won't be overflow issues)
64-bits is a problem, yes, but again like pcwalton said, it is being worked on for post ES6 era. Obviously, if the Unreal Engine is working, it's not necessarily critical & a show-stopper, but it is needed for certain things.
Edit: Math.imul is needed because the number can become large enough to where the engine converts it to a double, and then converts it back and you lose precision (I think that's how it works). It's the only arithmetic that needs fixing.
You conveniently skipped the complaint: "Even the modest 32-bit integer multiplication is tricky (you only have 52-53 bits of mantissa)"
No, in asm.js, numbers are not always floats. There is a type system that can classify numbers into integers. Native 64 bit integers are being worked on as an extension.
Downvoters: which part of the statement is factually incorrect? Read the ES3 and ES5 specs
There are faster more efficient ways of isolating a process - and better provided at an OS level (see Xax for instance).
PCC makes sense where you need to inline externally delivered code in a process - inline driver filters and so on.
/be
But that is changing and may still be true tomorrow but maybe not next year.