This content is over 7 years old. It may be obsolete and may not reflect the current opinion of the author.

Although the title broadly and vaguely referring to “mobile web apps”, Why mobile web apps are slow is actually a lengthy breakdown of JavaScript performance on mobile. tl;dr: too slow, and will stay relatively slow in feasible future.

Regretfully, because I was not formally trained as a computer scientist, I don’t have the necessary knowledge to judge whether or not the analysis of hardware architecture, garbage collection, or even interrupter development trends, are genuine or not. Nor I will try to be an web fanboy to pin the arthur as an Apple fanboy to repudiate what he just wrote. The question I would like to bring up is: Supposedly all of the analysis (and the conclusion) are true, what would the future holds for the Open Web, in post-PC world?

For the web to move away from JavaScript, there are currently two active proposals: Google Native Client (NaCl) and asm.js. NaCl comes with some trade-offs, like interpretability; asm.js on ARM is still in active development, and we will not know whether or not it would bring the same performance boost on x86.

Obviously, without JavaScript, the web as we (the front-end web developers) know it will cease to exist. It’s not necessary a bad thing though — while the web moving a way from a place I grew up, where everyone can find out the layout or logic of any website with view source, it had also involved to something much useful and powerful, embedded into everyone’s digital life more deeply. Yet, working on Mozilla payroll means there is no excuse to give up on the Open Web — even though I am not the person who make these decisions, thought experiments is always a fun thing to do.

So, maybe 10 years from now, website, or web apps would do this: Probe the CPU architecture of your hardware, drop the corresponding optimized asm.js or NaCl bytecode to your device, and render the entire screen with WebGL. There might even be Flash-like authoring tool for that, or even WebHAL — a library to abstract CPU/GPU differences. Think about what the Open Web gain or loose at that future.

As for JavaScript, in that future, people would have conversation like this comic (spooler alert below; thanks Kanru for the link):

— … Can’t remember its name. Today it’s mostly used just as a target language for compilers, but back in [the professor]’s days people actually used to write in it directly! — Oh, that must be JavaScript!

Perhaps, just like Lisp at the time, a dynamic-typing language is still too advanced for hardware circa 2013.