JavaScript engine

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A JavaScript engine is a computer program that executes JavaScript (JS) code. The first JS engines were mere interpreters, but all relevant modern engines utilize just-in-time compilation for improved performance.[1]

JS engines are developed by web browser vendors, and every major browser has one. In a browser, the JS engine runs in concert with the rendering engine via the Document Object Model (DOM).

The use of JS engines is not limited to browsers. For example, the Chrome V8 engine is a core component of the popular Node.js runtime system.

History[edit]

The first JavaScript engine was created by Brendan Eich in 1995 for the Netscape Navigator web browser. It was a rudimentary interpreter for the nascent language Eich invented. (This evolved into the SpiderMonkey engine, still used by the Firefox browser.)

The first modern JavaScript engine was V8, created by Google for its Chrome browser. V8 debuted as part of Chrome in 2008, and its performance was much better than any prior engine.[2][3][4] The key innovation was just-in-time compilation, which can significantly improve execution times.

Other browser vendors needed to overhaul their interpreters to compete.[5] Apple developed the Nitro engine for its Safari browser, which had 30% better performance than its predecessor.[6] Mozilla leveraged portions of Nitro to improve its own SpiderMonkey engine.[7] Opera replaced its interpreter with the Carakan engine, which was twice as fast in some cases.[8]

Since 2017, these browsers have added support for WebAssembly. This enables the use of pre-compiled executables for performance-critical portions of page scripts. The JS engines execute WebAssembly code in the same sandbox as regular JS code.

Notable engines[edit]

  • Chakra is the current engine of the Microsoft Edge browser, forked from the same-named engine of Internet Explorer. However, Microsoft is now rebuilding Edge as a Chromium-based browser,[10][11] so it will be using V8 instead of Chakra. Internet Explorer continues to use its version of Chakra.

References[edit]

  1. ^ Looper, Jen (2015-09-21). "A Guide to JavaScript Engines for Idiots". Telerik Developer Network. Retrieved 2016-03-17.
  2. ^ Shankland, Stephen (2008-09-02). "Speed test: Google Chrome beats Firefox, IE, Safari". CNET Business Tech. CBS Interactive. Retrieved 2010-06-28.
  3. ^ "Big browser comparison test: Internet Explorer vs. Firefox, Opera, Safari and Chrome". PC Games Hardware. Computec Media AG. Retrieved 2010-06-28.
  4. ^ "Lifehacker Speed Tests: Safari 4, Chrome 2". Lifehacker. Retrieved 2010-06-28.
  5. ^ "Mozilla asks, 'Are we fast yet?'". Wired. Retrieved 18 January 2019.
  6. ^ Safari 5 Released
  7. ^ Shankland, Stephen (2010-03-02). "Opera 10.5 brings new JavaScript engine". CNET. CBS Interactive. Retrieved 2012-01-30.
  8. ^ Shankland, Stephen (February 5, 2009). "Need for speed spurs Opera JavaScript overhaul". CNET. CBS Interactive.
  9. ^ Stachowiak, Maciej (November 9, 2008). "Companies and Organizations that have contributed to WebKit". WebKit Wiki. Retrieved April 13, 2019.
  10. ^ Belfiore, Joe (2018-12-06), Microsoft Edge: Making the web better through more open source collaboration, Microsoft
  11. ^ "Microsoft Edge and Chromium Open Source: Our Intent". Microsoft Edge Team. 6 December 2018. Retrieved 8 December 2018.
  12. ^ Tung, Liam (2019-07-12), Facebook just released this new open source JavaScript engine, ZDNet