unknown source

Why do I believe web apps can be as fast as native apps?

And an insight on why most assumptions are wrong

Elsa
Published in
3 min readOct 31, 2013

--

Since the latest hype to mobile libraries for native-ish html5 apps, there has been quite an argument about wether a web app can ever be as fast as an equivalent native app.

My short answer is: Yes. Although my prig answer woul’ve been: the sole question is wrong because it shows some misconceptions.

I will focus on one image I stepped on at twitter, which pretty much sums up some wrong stands.

Well, at first glance I was a little disturbed by the fact that it says “mozilla” on the top. But after googling textual parts of the text, I couldn’t find the source of such statement. Being locked and incompatible is against everything the web stands for, but this contention is also against everything Mozilla stands for, and also, untrue.

First I am going to tell you why this slide is wrong, I am not going to talk about grammar stuff, just what a non-believer customarily say:

  1. “As good”. What is good?, What is better?. It’s not even specified wheter it refers to speed or not. But as it’s trying to contrast native vs non-native, let’s assume it does and move on.
  2. It implies that one native language can be only supported by one <insert a software-based platform> and only one. As if we couldn’t compile C++ code for many OS or architectures. Yes, there are hardware specific APIs, but just because some drivers are non-standard.
  3. Also implies that native languages equals assembler language when we are surrounded by middle to high level native languages.

The definition of native:
Native software is a piece of binary code to be executed directly by the hardware… well, not really, not anymore, the definition of “native” has trivialized as the abstraction level of computer languages increases. Now being native is just a matter of how well supported a technology is on a platform. Today, code is considered native if it can be executed by the OS, most times regardless of the hardware arquitecture you are working on (like running software for a Mac on a PC with hackintosh), even sometimes with an extra layer on top, just as a bytecode interpreter.

So, why do I think it’s possible for a web app to be as fast as a native one?

  • Because a Web browser is an interpreter. Just like many platforms which power applications widely accepted as “native” despite not being really stand-alone. In some context and tasks, raw JS can get better performance in, say, 3D graphics than Java and almost as good as Objective-C.
  • Because, as an interpreter, a web browser is nothing more than a compiler which translates runtime. Today’s binaries are also made by a combination an abstract language + XML for the UI part. We can compile binary from any laguage and we actually do, after all, it’s the only way a machine can understand (yet).
  • The performance of an app is not even language dependent, but it depends on how the compiler translate the code to binary (and how farsighted the parser is). So, it’s just a matter of letting browsers mature.
  • Because HTML5 is already a native technology in platforms like Gnome, FirefoxOs and ChromeOs.
  • Because the people behind the web is already working on implementations to let the browser compile first and then execute (see asm.js specs).
  • We maybe can’t always compile the same code for every system, but that is just because it has some lower level instructions (or communicates with specific drivers) and I don’t see why wouldn’t that work on the web. We already install plugins to be able to get camera access, hardware and OS support can totally be built in the browser.

Final thoughts

It can be done with agreement and hard work from many people. I don’t know how long it would take to get low level performance as a market standard or if it will ever get that far (there is chance for higher hardware upgrading to be more feasible). But even that way, there is no good on standing on the right posture by the wrong reasons, and I deffend that even when I may not know what will happen with this technology, I can discern this claims I am trying to debunk them as mistaken.

--

--