JavaScript-and-Metaperformance

JavaScript and Metaperformance

No doubt that Java has been proved as the best object in the history of programming languages. It gets combined with prototypes and first class objects to be proved as the best idea for the programmers and enormous expressing power to Java but historically it has been very so. Early implementations were optimized to time to market. The gradual speed reductions due to the 15 years of patching, the JavaScript becomes a hugely popular language anyway. Without any change, we now have Frenzied Competition that enables everyone, who wants to have the fastest JavaScript Engine.

However, the JavaScript is a sort of “Load and Go” system as the JavaScript programs are delivered to the execution site in source coded text and then it is complied as well as executed immediately and this is a different thing as compare to other different languages. This was done to facilitate embedding of JavaScript programs into HTML, which is something is now considered a bad practice due to interference with minifying, compression, cashing etc. Another thing about the JavaScript and the HTML, which is bad, is that it becomes vector for assassin junction, which is the biggest security hazard in browsers.

As it is a “Load and Go” system so it does not offer any time for optimizing. Optimizing and compiling and do wonderful things to make codes go faster but it takes many minutes to do that work and we do not have much time on the web. However, it is said because,

  • ECMAScript programs are expected to start execution instantly.
  • ECMAScript does not specify an executable format or a virtual machine.
  • There is a tradeoff between off-line optimization and portability.
  • Portability is the web’s most valuable feature as Portability is the single best that web has over all other applications delivered to systems.

Some people mix up the both terminologies that Java and JavaScript has similar nature but it is has nothing to do with similarity as Java does not have functions to the first class objects and does not have prototypes as it is not much there but Java was supposed to be the world’s biggest programming language as it apples were to rule the world in the late 20th century. The biggest failure in the history of software development as:

  • Failed security model
  • Lack of portability (write once, debug everywhere)
  • Awful UI Toolkit
  • Horrendous startup times (class-loading)

However none of these problems were tend to be considered as big problems on the server so that it has been used there without having any issue.

Back to the main topic, there does not survive an executable format that is secure, highly optimizable and highly portable and this was the situation found with the JavaScript. So instead, we were forced to do to optimize as you go as it is the style of execution of self language which is applied to JavaScript and make the process to run faster

Now, there is a question that how fast are the new engines? That is really a complicated question to answer. There might not be any single member who could answer the question that how fast is the language processer. It depends on what programs are giving and every program can have a different looks and features, which may explore some specific benefits as same benefits might be a drawback in certain conditions so we never know the answer but the best we can do is to benchmark. Benchmark promotes patterns that engine implementers want to implement and also promote the patterns that resemble benchmarks. But the benchmarks are not the representative of real program.

The engine makers are tuning to the benchmarks, struggling to produce the best numbers because the performance without the measurement is completely meaningless and they do not know what else to do. Now, it is contrasted that the life on the web. Web developers have a difficult time with the browsers and desire to produce applications that are highly response.  Browser platform contains some deep inefficiency and if you run through those inefficiencies, your application will be seriously deteriorating as little visibility into the cause of performance degradation.

The biggest problem with browsing in terms of performance is the DOM and the DOM is the Bottleneck. If the JavaScript engine were infinitely fast, most of the web applications would run about the same speed because it is not the JavaScript engine, which is the limited but it is the DOM. Browsers spend most of their time in layout, painting, marshalling, styling, IO and so on. The benefit of faster JavaScript engines is the enabling of new kinds of applications. However the life on the web said out of frustration, many developers area dedicated to optimizing their JavaScript code, even though it is not effective.

According to Mr. Donald E. Knuth, premature optimization is the root of all evil and it is an absolute fact. However, the web developers believe that they must optimize prematurely because they will not be given a chance to do it later. In order to make a selection between two language features, put each in a loop and run 1000 times. Always use the winner, even if:

  • The difference was not significant
  • The race is likely to go the other way in future versions
  • This results in code that is more difficult to read or maintain

On the other hand, they are trying to do the right thing and they think themselves responsible and heroic. This behavior of developers interacts badly with performance benchmarks, as it can be stated that benchmarks lead the direction towards the engine performance that is driving the programming style. It can be assumed that the benchmarks are discouraging good programming practices. However, it is said that the good coding practices and it is said by the man who discovered that JavaScript has good parts and also developed programming patterns that make use of the good parts while avoiding the bad parts. In addition, he also developed a code quality tool, JSLint, to help developers use the good parts more effectively as JSLint is a program that advises you on how you can make it better. It is concerned that the benchmarks are having the unintended consequence of worsening the language and its usage. The benchmark is JSLint, measuring how long it takes to analyze jslint.js and it also demonstrates real application behaviors that are not exercised in the other benchmarks, especially prototypal and functional patterns. It is a test only of JavaScript performance. It does not measure any of the other aspects of browsers performance.