News for hackers. Stuff that matters.
Re:Why Asm.js Bothers Me by hosay123 on Thursday March 28, 2013 @04:45PM (#5457479)
He makes a solid point regarding polyfills for asm.js: if the specification is so rigorously defined, then the only fallback a current-generation browser has on offer when encountering a "v2 asm.js" is to treat it like regular Javascript. That's a pretty nasty regression, and hopefully one that will be addressed.

Regardless I still prefer building on Javascript than any proposed alternative. No matter what happens next, any pristine standard is going to look like an overextended mess even in just a few years time. So why not pick the overextended mess we started with.

Re:Why Asm.js Bothers Me by dherman on Thursday March 28, 2013 @07:03PM (#5458235)
We've talked about versioning, and I think feature detection is probably the best approach. If the user agent publishes a list of supported asm.js features via a standard query mechanism (note that this is a feature list, not browser detection) -- e.g., ASM.SIMD === true -- then apps can negotiate content accordingly. This might entail compiling multiple versions of your codebase for various versions of asm.js, but that's an acceptable price to pay for VM evolution, IMO.
Re:Why Asm.js Bothers Me by constexpr on Thursday March 28, 2013 @05:27PM (#5457766)
Ouch, that's a great point about versioning.

The thing that appeals to me about asm.js is that it short-cuts the long, slow path of VM optimization and gives great performance now instead of five years down the road. Sure it's an ugly hack but that doesn't matter to your users, all they see is a much faster user experience.

Now all we need is a SIMD API for JS and we can write some truly amazing apps.

Re:Why Asm.js Bothers Me by niggler on Thursday March 28, 2013 @05:36PM (#5457816)
"it short-cuts the long, slow path of VM optimization and gives great performance now instead of five years down the road."

Something tells me that, based purely on usage metrics, chrome matters more than firefox:

http://stats.wikimedia.org/archive/squid_reports/2013-02/Squ...

(and pretty much every other metric according to https://en.wikipedia.org/wiki/Usage_share_of_web_browsers#Hi... )

Re:Why Asm.js Bothers Me by Elv13 on Thursday March 28, 2013 @11:32PM (#5459112)
Thats starcounter numbers. Do you really think IE is bellow 30%? Chrome numbers are inflated.
Re:Why Asm.js Bothers Me by niggler on Thursday March 28, 2013 @05:00PM (#5457568)
"So why not pick the overextended mess we started with."

What's the starting point? Javascript or assembly? NaCl gets closer to the original starting point (which predates javascript by more than 20 years)

Re:Why Asm.js Bothers Me by bcoates on Thursday March 28, 2013 @06:58PM (#5458216)
By my count Javascript is around 5 years older than amd64. If we had gone with native client back then we'd be stuck with pre-SSE x86 or maybe they'd have been forward-looking and gone with Alpha or Itanium with emulation for "legacy" systems.

Also, why the false choice between asm.js and NaCl anyway? The article makes a pretty compelling case for "neither".

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @07:36PM (#5458348)
> By my count Javascript is around 5 years older than amd64. If we had gone with native client back then we'd be stuck with pre-SSE x86 or maybe they'd have been forward-looking and gone with Alpha or Itanium with emulation for "legacy" systems.

That's not really how NaCL works. Any instruction that can't break out of the jail can be whitelisted; this includes all versions of SSE.

Additionally, PNaCL can be retargeted at as-of-yet unknown architectures.

The result is that binaries would have been either shipped as PNaCL-only, or optimized for i386+SSE1 with fallback to PNaCL. As new hardware was shipped, new binaries could be targeted appropriately.

This seems reasonable to me; default to portability, provide an option for best-case performance.

Re:Why Asm.js Bothers Me by pcwalton on Thursday March 28, 2013 @08:58PM (#5458659)
How do you plan to ensure that authors test and ship working and performant PNaCl binaries if they and their users are always using the native code?
Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @09:18PM (#5458728)
How did Apple developers ship working PPC/m68k binaries? Or PPC/x86 after that, later PPC/x86/x86-64, and armv6/armv7/armv7s on the iPhone?
Re:Why Asm.js Bothers Me by pcwalton on Thursday March 28, 2013 @11:29PM (#5459102)
Totally different. In all of those cases, the developers have access to devices that run the hardware, and they have economic incentive to target all of those devices. Whereas with your suggestion, developers ship and test native builds for all of the CPUs on the market, plus one extra "portable" version for posterity, one that no immediate customers will ever use (because they'll be using the native versions for their architecture instead). I suspect developers wouldn't even ship the portable version (too much of a pain), browsers won't optimize it (because nobody will use it), and developers won't test it (because nobody will use it).

It's like saying that images are no problem for accessibility on the Web, because designers know to use alt text. Of course they know they should, but we all know what the reality is. A backup "portable" version of an app is like alt text in this way. Some developers would do the right thing; many won't, and the Web will be de facto locked in to x86 and ARM forever.

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @11:42PM (#5459131)
That's a bit ridiculously alarmist, isn't it? Heck, you could have lead with that, rather than waiting for me to reply -- you seem to already know what you wanted to say.

Won't developers have access to PNaCL runtimes? How is this so different than Apple developers having access to the other target hardware

It comes down to toolchains and the workflow they're optimized for. With PNaCL, the portable version is the primary target of the toolchain, from which one generates other native binaries. You can still generate native binaries separately, but ideally, PNaCL would lead.

If the tools lead naturally in the right direction, then developers do follow. If you're feeling really worried about it, define a distribution format that mandates a PNaCL entry.

Re:Why Asm.js Bothers Me by hosay123 on Thursday March 28, 2013 @05:10PM (#5457655)
In the context of manipulating symbols on an infinitely long piece of tape, sure, but in the context of the web we don't "have" NaCl and there's sufficiently plausible technical and political resistance that we're probably never going to.

At various points he talks about how a fresh byte code would address some of the issues raised, and certainly from a full time compiler engineer's perspective, some pristine representation and a handful of tree-walks are obviously going to appeal to his academic side. I just doubt any such perfectly forward-compatible ideal representation will ever exist that can cater to all camps and survive the test of time, because to my knowledge such a thing has never existed.

So why abandon our current path for something that'll inevitably end up as ugly as JS in the long term, when we already have something as ugly as JS.

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @05:36PM (#5457822)
> ... there's sufficiently plausible technical and political resistance that we're probably never going to.

Resistance that you contribute to with almost every article that touches on NaCL, yes.

It's self-fulfilling prophesy and a circular argument: "We can't adopt NaCL because nobody will ever adopt NaCL" -- say the people responsible for choosing whether to adopt NaCL.

> So why abandon our current path for something that'll inevitably end up as ugly as JS in the long term, when we already have something as ugly as JS.

Why is this the "inevitable" result?

Re:Why Asm.js Bothers Me by hosay123 on Thursday March 28, 2013 @05:43PM (#5457862)
Show me a counterexample, that's all I ask. I'd give all the rhetoric in the world for a single damned counterexample of a program format that's lasted since the 80s. That's what's at stake.

Instead we have a company that throws specs over the wall like they're teenaged nerds that have just discovered Pascal's pack function, a company that pushed SPDY on everyone despite it relying on a draft SSL feature that got rejected at the IETF (and in the space of 2/3 years we now have three HTTP variants - and why? Because 3 years ago it shaved 1ms off a maps.google.com request). Did you even take a look at the original WebSocket spec? It worked in terms of comparing the entire start of the HTTP request using memcmp()!

Regardless of my opinion of NaCl, this is stuff that should be getting defined slowly and in the open by bearded old men that have spent their lives in glacial, trusted industries like telecoms, or just about any other mature technology industry. Not a throng of Java graduates who think they're changing the world by continually dumping crap specs over the wall and paying for subsidized articles to promote them.

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @06:07PM (#5457997)
> Show me a counterexample, that's all I ask. I'd give all the rhetoric in the world for a single damned counterexample of a program format that's lasted since the 80s. That's what's at stake.

ELF was defined in the late 80s/early 90s as part of SVR4. COFF was defined as part of SVR3. Both still exist today.

The JVM bytecode was defined in 1995 and has been evolved compatibly.

I'm curious, though. Do you require the same longevity of web formats that were defined in the 90s? Things have changed quite a bit, and attempting to browse the modern web with a 90s browser is futile.

Given that, I don't really understand what you're arguing for.

> Regardless of my opinion of NaCl, this is stuff that should be getting defined slowly and in the open by bearded old men that have spent their lives in glacial, trusted industries like telecoms, or just about any other mature technology industry.

Us 'bearded old men' aren't on the web, and its only improvements like SPDY, WebSockets, and NaCL that have made me the slightest bit interested in the web as an application platform.

Re:Why Asm.js Bothers Me by pyre on Thursday March 28, 2013 @07:11PM (#5458257)

  > attempting to browse the modern web with a
  > 90s browser is futile
I think the inverse is what we're talking about. Will we be able to browse NaCl sites in future browsers (possibly after an architecture change away from x86)? As it stands, we would probably be able to browse a 90's site on modern browsers.

It sounds like if NaCl compiles things down to ASM x86 (or really AMD64) (?). If that's true, then it's possible for things to not be forward compatible. I'll admit that it doesn't seem likely, especially after what happened with Itanium and AMD64/x86-64, but we could see things move towards ARM.

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @07:15PM (#5458268)
> I think the inverse is what we're talking about. Will we be able to browse NaCl sites in future browsers (possibly after an architecture change away from x86)? As it stands, we would probably be able to browse a 90's site on modern browsers.

Given PNaCL, the answer should be 'yes'.

Re:Why Asm.js Bothers Me by mbetter on Thursday March 28, 2013 @11:34PM (#5459117)
For future Google browsers, maybe.
Re:Why Asm.js Bothers Me by prodigal_erik on Thursday March 28, 2013 @09:04PM (#5458677)
> attempting to browse the modern web with a 90s browser is futile

And it's hard to imagine stronger evidence that the people designing the "modern web" are not the few who are willing and able to do a competent job of it.

Re:Why Asm.js Bothers Me by niggler on Thursday March 28, 2013 @05:52PM (#5457920)
"a throng of Java graduates who think they're changing the world by continually dumping crap specs over the wall and paying for subsidized articles to promote them."

Based on the media hype surrounding asm.js, it really sounds like mozilla fits the description

Re:Why Asm.js Bothers Me by shardling on Thursday March 28, 2013 @06:39PM (#5458141)
>Based on the media hype surrounding asm.js, it really sounds like mozilla fits the description

Wait, what? I'm not even sure what you're trying to say here. If you seriously think Mozilla has payed for articles about themselves, you've gone off the deep end.

I know that I personally became aware of asm.js because of an offhand comment Eich made on HN. I posted that link on both reddit and HN, which I guess was the start of the hype, so if you could let me know where to collect my Mozilla money I'd be obliged. :)

Re:Why Asm.js Bothers Me by nitrogen on Thursday March 28, 2013 @05:45PM (#5457869)
The actual arguments against NaCl have been reiterated many times, and go well beyond the circular reasoning you suggest is being displayed. Unless you want to argue for the fun of arguing, the polite thing to do is to consider the previous arguments as implicitly included in the current discussion, and interpret other comments as charitably as possible.

For the sake of completeness, I'll note one of the biggest detriments of original NaCl: a lack of platform independence.

Re:Why Asm.js Bothers Me by niggler on Thursday March 28, 2013 @05:49PM (#5457894)
"a lack of platform independence"

Platform independence is not an obvious goal for game developers. If it were, you would see the same game show up in every platform, but that's not what we see. Heck, only recently did we really see games show up for Mac. For high performance contexts, you want to be able to express algorithms in a way that takes full advantage of the hardware, and the lack of homogeneity in hardware demands a platform-dependent solution.

Re:Why Asm.js Bothers Me by coldtea on Thursday March 28, 2013 @07:23PM (#5458297)
>Platform independence is not an obvious goal for game developers.

The web is not a platform solely for game developers.

Run native game code inside a browser why?

What exactly do you get over, say, running it natively as a desktop/mobile app and just distributing it over the internet and/or web?

Re:Why Asm.js Bothers Me by TheZenPsycho on Thursday March 28, 2013 @08:02PM (#5458451)
zero installation.
Re:Why Asm.js Bothers Me by coldtea on Friday March 29, 2013 @08:07AM (#5460316)
With things like Valve and the Mac App Store, installation is a non problem.

I have less issues downloading and updating an app like that, than keening with the subpar experience that is web games, browser compatibility et al.

Not to mention that with the speed of todays networks, even manual installation is a non problem.

We can even put a nice facade on top of it: "just visit this page and click "Install" and you get an app running locally after some small download time. It will even be sandboxed and all-in-one, so it won't mess any part of your system".

Re:Why Asm.js Bothers Me by TheZenPsycho on Friday March 29, 2013 @06:20PM (#5463345)
"just visit this page and click "Install"" That's one (and possible more) step than is necessary.
Re:Why Asm.js Bothers Me by coldtea on Friday March 29, 2013 @08:59PM (#5463917)
As if that matters one iota.

For one, it's merely one of around 20 steps you have to take in either case anyway (steps like: type url, press enter to goto page, wait for page to load, click through some license staff, click to start to play, click for fullscreen if you want, wait for assets and loading, click game settings, suffer through the intro, read help for the game controls, etc). So, yes, you might get rid of one measly step -- all the while introducing other steps, lags and inefficiencies.

Second, this step buys you freedom from having the program run on somebody else's mercy. Of course for networked games and apps with central servers you cannot avoid it.

But I would sure as hell like to avoid it for any program that doesn't need a central server. I don't want to use "Photoshop in the browser" and loose all my stuff when Adobe decides to lock me out or kill the service a la Google Reader. Plus have it be susceptible to internet outages, slowdowns, and using technologies and speeds that's 2-3 generations behind a native app. Not all programs gain from running on the browser. A lot of them lose.

Re:Why Asm.js Bothers Me by TheZenPsycho on Saturday March 30, 2013 @04:20AM (#5464831)
That's a lot of strawmen you've set up there. Want a lighter? We can burn them down together.

Yes the scenarios you describe are ridiculous and unacceptable. But thankfully we live in the real world where those extra steps you describe don't actually exist in apps that were programmed by actually good programmers.

As for whether it matters one iota: It matters if you want more people to play your game. You are a progammer, and so you don't perceive the actual difficulty level of software installation. On the other hand, for normal people with average skill levels, having to install software can present a significant barrier to entry.

Re:Why Asm.js Bothers Me by coldtea on Saturday March 30, 2013 @07:06AM (#5465055)
>Yes the scenarios you describe are ridiculous and unacceptable. But thankfully we live in the real world where those extra steps you describe don't actually exist in apps that were programmed by actually good programmers.

I have not seen even ONE (ONE) online app or game, where most of the above steps do not exist. You might be able to find one. I doubt you'll find two, much less five.

So, straw-men? Puh-lease.

>It matters if you want more people to play your game. You are a progammer, and so you don't perceive the actual difficulty level of software installation.

For one, you sidestepped all my arguments. I proposed systems like the Mac App Store and Valve -- and even more automated solution, like the Java Web Start for the 21st century (click a button on a webpage, and it's installed and running locally).

And yet, you tell me that "for normal people with average skill levels, having to install software can present a significant barrier to entry", as if we were discussing manual installers and stuff.

You are responding not to what I said, but to the preconceived ideas you have about traditional installers. The stuff I discussed (MAS, etc) are not at all "a significant barrier to entry".

Heck, 5 year olds to 70 year olds can use them just fine on their Mac or their iPhone. I've seen that.

Re:Why Asm.js Bothers Me by rhu86 on Thursday March 28, 2013 @08:47PM (#5458610)
I wonder what effect it would have on people's ability to pirate it
Re:Why Asm.js Bothers Me by TheZenPsycho on Thursday March 28, 2013 @09:45PM (#5458805)
People's ability to pirate games is already broken- the more of a game's essential logic gets moved onto a server, the more useless the blob of code you hand over to clients is.

On the other hand, that also destroys a game's ability to be archived, creating a cultural "dark ages" if the approach picks up adoption. "Piracy" is essential to future historians.

Re:Why Asm.js Bothers Me by pifflesnort on Thursday March 28, 2013 @05:58PM (#5457945)
NaCL is gated on PNaCL. NaCL can provide optimal performance, PNaCL can provide portability.