Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Recently I had the the sensation that the world is trying to port every existing application in HTML5. The proliferation of Javascript API meant to cover almost every programmer's need is the tangible proof. There's an API for every taste: graphics (2D/3D), audio, video, realtime communication, filesystem access, permanent storage, database, connectivity and many more. Everythings seems really nice, but the shame is that at the basis we have Javascript.

Now, I cannot say that I'm a real every-day Javascript programmer, and I don't know anyone like that, that's why my experience is not so meaningful, but in the last time I found myself writing some prototypes to see which can be the limit of HTML5. The outcome for me has been discouraging. I find that the language itself, when writing something more complicated than dealing whith some DOM manipulation and event-handling, is not handy (read: maintainable, readable, sharable, ..). But the real problem is not the sytax which may be a matter of taste, but the fact that I see there is a stubborness of people trying to make a universal language out of Javascript, with the browser acting as a sort of a Virtual Machine, which, as a matter of fact, is not and never(?) will be.

The availability of new APIs certainly creates many possibilities, and developers are trying to take advantage of them, but at the end they may eventually fight against the inevitable and intrinsic slowness of the language. A slow language, even with every possible shiny feature, remains a slow language, and in some cases this is a true limit.

In the past 5/6 years we have seen really huge improvements in Javascript enginges, but today Javascript is still a slow language, and I have the feeling that there is no more room for great improvement in this.

So, what now?

With GWT (that I think has already reached its top), Google wanted to simplify the developers' life, taking Javascript away from them, and offering every kind of optimization to squeeze Javascript at its limit.

Then Google created a new language, dart, with its own Virtual Machine running on a browser ([Dartium]), and which aspires to completly replace Javascript from every browser; in the meanwhile you can always compile it into Javascript (as GWT does).

Mozilla has created asm.js where (if I get it right), one can write applications in C/C++, compile the code with clang obtaining LLVM bitcode, which can be compiled again in (a small subset) of Javascript, which, if executed in a special version of Firefox, it can reach great performance.

Now, as a programmer, I find myself writing a real HTML5 program, where I have to fight against the Javascript poor performance, and I see that the world is puzzling trying to find exotic ways to overcome the problem, and I ask myself: would it be such a bad thing to keep Flash (or equivalent technologies) alive? Isn't this Javascript hype (I'm exaggerating here..) just trying to make it behave different from what it actually is? Am I the only one seeing this trend?

share|improve this question

closed as not constructive by Jim G., Dynamic, BЈовић, MichaelT, World Engineer May 26 '13 at 22:43

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

70% of the question appear to be a rant that should be removed. And while I'm here: Your characterization of asm.js is inaccurate, it's not limited to porting C and C++ code and is independent of LLVM, Mozilla, etc. –  delnan May 25 '13 at 12:42

1 Answer 1

Performance to a great extent is a concern of the implementation and how you write your code. You are blaming the language itself which only gives syntax and semantics. In fact, using an implementation like V8 and writing code in a certain way, you can have excellent performance.

The problem is that it comes down to writing code like you would write in a statically typed language.... without anything really enforcing that you really wrote the code that way (Unless you use GWT, Dart, Typescript etc). Subtle differences in code can cause orders of magnitude differences in performance.

And no language will have particularly great performance if you need dynamic semantics. Do you think a Java program using reflection for everything, dynamically generating code and running it reflectively at run time etc will run much faster than Javascript?

So from performance point of view, I do not think it's a loser.

share|improve this answer
+1--Great answer, could not have said it better. –  Matthew Patrick Cashatt May 25 '13 at 14:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.