Type inference will be added to Firefox 9

Source: Internet
Author: User

After 18 months of effort, Mozilla finally successfully added a major new feature to Firefox's Javascript Engine. According to preliminary tests, it can improve Javascript performance by at least 20% to 30%. This new feature is the Type Inference added to the JaegerMonkey JIT compiler of Firefox, which will be provided for testing along with Firefox 9. The type inference was first mentioned in the Firefox 5 era a few months ago, but it was not the first time it was on the stage until now. If you are a web programmer, you will be shocked! If you are not familiar with the technology, here is a brief introduction to type inference.

In each programming language, variables and functions have a type. It can be an integer, a string, a floating point number, an array, or a class ...... These internal structures are critical to the compiler of the programming language. Some languages are strongly typed, which means that programmers must define a type for each class, function, and variable. This is annoying, but in return it will greatly increase the running speed; there are also some languages, such as Javascript, which are weak types of languages. That is to say, programmers do not have to worry about these trivial details. They can write code as they wish to let the compiler back up this burden. Type inference makes up for the gap between strong and weak languages. You can continue to write code according to the habits of weak languages, however, the browser will make the optimal assumptions for the type based on the usage, so as to still improve the performance.

For Firefox 9, the data inference engine can improve Javascript performance by 30%. The specific improvement values vary according to the test results, but the performance improvement is beyond doubt. According to the test results on a computer configured with Intel i7 930 @ 3.8 GHz, memory 6 GB, and graphics card Nvidia GTX 460, when the type is disabled, the completion time of Kraken Benchmark is 3895 milliseconds. After type inference is enabled, the time is shortened to 2763 milliseconds. In V8 Javascript Benchmark, the score for disabling type inference Firefox 9 is 6075 points, and after enabling type inference, the score is increased to 6585 points. Even in the old Microsoft HTML5 Sudoku test, the 10000-level type inference reduces the execution time from 2.6 seconds to 1.62 seconds. In the FishBowl Frame Rate Test, 2000 fish, when type inference is enabled, the performance is improved by 15%-20%.

Firefox 6, that is, the browser you are using. Its Javascript Engine is basically the same as Firefox 9, except that there is no type inference. So it can be basically said that Firefox 9 is 30% faster than the current browser in executing Javascript.

Finally, before you install and run Firefox 9 Nightly, we should note that in the current version, type inference may still cause slow speed of some scripts-the 64-bit version should be okay, however, the 32-bit version may have some problems. In terms of time, Firefox 9 will arrive at Aurora by the end of September.

ExtremeTech address: http://www.extremetech.com/computing/94532-firefox-9-javascript-performance-improved-by-20-30-with-type-inference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.