Jump to content

JavaScript engine: Difference between revisions

From Simple English Wikipedia, the free encyclopedia
Content deleted Content added
Julipero (talk | changes)
Link suggestions feature: 2 links added.
→Design: a Word Spell Error.
Line 5: Line 5:
JavaScript was originally created as a [[scripting language]] to allow [[Webpage|web pages]] to have changing, or dynamic, elements. Early Javascript engines were created as [[Interpreter (computing)|interpreters]], programs that simply read the script and execute the instructions without analyzing it any more.
JavaScript was originally created as a [[scripting language]] to allow [[Webpage|web pages]] to have changing, or dynamic, elements. Early Javascript engines were created as [[Interpreter (computing)|interpreters]], programs that simply read the script and execute the instructions without analyzing it any more.


As JavaScript started being used more an more as a [[General-purpose programming language|general-purpose language,]] execution speed, or how quickly the code is run, became more important for JavaScript engines. In response, many engines, such as V8 (Used in [[Google Chrome|Chrome]] and [[Chromium (web browser)|Chromium]]) and SpiderMonkey (used in [[Mozilla Firefox|Firefox]]), started using Just-In-Time Compilation. In this method, it starts by [[Compiler|compiling]] all of the code to optimized [[machine code]], which is typically faster than interpretation, then running the result.<ref>{{Cite web|last=Doglio|first=Fernando|date=2020-08-12|title=The JIT in JavaScript: Just In Time Compiler|url=https://blog.bitsrc.io/the-jit-in-javascript-just-in-time-compiler-798b66e44143|access-date=2021-01-02|website=Medium|language=en}}</ref><ref>{{Cite web|title=A crash course in just-in-time (JIT) compilers – Mozilla Hacks - the Web developer blog|url=https://hacks.mozilla.org/2017/02/a-crash-course-in-just-in-time-jit-compilers|access-date=2021-01-02|website=Mozilla Hacks – the Web developer blog|language=en-US}}</ref>
As JavaScript started being used more and more as a [[General-purpose programming language|general-purpose language,]] execution speed, or how quickly the code is run, became more important for JavaScript engines. In response, many engines, such as V8 (Used in [[Google Chrome|Chrome]] and [[Chromium (web browser)|Chromium]]) and SpiderMonkey (used in [[Mozilla Firefox|Firefox]]), started using Just-In-Time Compilation. In this method, it starts by [[Compiler|compiling]] all of the code to optimized [[machine code]], which is typically faster than interpretation, then running the result.<ref>{{Cite web|last=Doglio|first=Fernando|date=2020-08-12|title=The JIT in JavaScript: Just In Time Compiler|url=https://blog.bitsrc.io/the-jit-in-javascript-just-in-time-compiler-798b66e44143|access-date=2021-01-02|website=Medium|language=en}}</ref><ref>{{Cite web|title=A crash course in just-in-time (JIT) compilers – Mozilla Hacks - the Web developer blog|url=https://hacks.mozilla.org/2017/02/a-crash-course-in-just-in-time-jit-compilers|access-date=2021-01-02|website=Mozilla Hacks – the Web developer blog|language=en-US}}</ref>


== References ==
== References ==

Revision as of 12:32, 5 August 2025

V8 (JavaScript engine) logo

A JavaScript engine is a program that runs JavaScript code. Web Browsers often have a JavaScript engine. It can also be used outside of web browsers, such as running services in Node.js or apps in the electron framework.

Design

JavaScript was originally created as a scripting language to allow web pages to have changing, or dynamic, elements. Early Javascript engines were created as interpreters, programs that simply read the script and execute the instructions without analyzing it any more.

As JavaScript started being used more and more as a general-purpose language, execution speed, or how quickly the code is run, became more important for JavaScript engines. In response, many engines, such as V8 (Used in Chrome and Chromium) and SpiderMonkey (used in Firefox), started using Just-In-Time Compilation. In this method, it starts by compiling all of the code to optimized machine code, which is typically faster than interpretation, then running the result.[1][2]

References

  1. ↑ Doglio, Fernando (2020-08-12). "The JIT in JavaScript: Just In Time Compiler". Medium. Retrieved 2021-01-02.
  2. ↑ "A crash course in just-in-time (JIT) compilers – Mozilla Hacks - the Web developer blog". Mozilla Hacks – the Web developer blog. Retrieved 2021-01-02.