过去十年中众多的 JavaScript 运行时

  • July 27, 2025: An image shows Jamie jogging on a sports track wearing a JavaScript vest.
  • JavaScript runtimes and engines: The last decade saw a flood of new JavaScript runtimes and engines, enabling JavaScript to run in various contexts. This article explores the diversity and reasons behind it.

    • Edge computing: In 2002, Akamai introduced the first consumer "edge computing" solution. JavaScript joined the edge with Lambda@Edge in 2016 and 2017, followed by Cloudflare Workers in 2018 and Deno in 2018. Bun and Wasmer also entered the arena in 2022 and 2023 respectively. Different runtimes use different engines like V8, JavaScriptCore, SpiderMonkey, and QuickJS.
    • Microcontrollers: Microcontrollers have limited computing capacity. Slim engines like Duktape, Espruino, and JerryScript were developed to run on microcontrollers. These engines spawned new runtimes for the Internet of Things.
    • Polyglot engines: Some JavaScript engines are based on established VMs, enabling zero-cost interop with other languages. Examples include Rhino, Nashorn, Graal.js, and many others written in different languages. JavaScript engines are even being implemented in JavaScript itself.
    • Native apps: JavaScript is well-suited for building GUI apps and is used in native apps through cross-platform frameworks.

      • Web view based apps: Frameworks like PhoneGap (now Cordova) and Electron use web views to embed web apps in native apps. Cordova is used on various platforms including Smart TVs. React Native also uses a JavaScript runtime to render native views and has made improvements over time.
      • React Native: It is a cross-platform framework for mobile and has significant usage on both iOS and Android. It has also been used on Smart TVs. Hermes is a new engine for React Native that offers improved performance. React Native is becoming more engine-agnostic and is on track to become the most popular app development framework.
      • NativeScript: It offers three separate runtimes with full JavaScript bindings to iOS, Android, and Universal Windows platforms. It is rearchitecting its runtimes to be engine-agnostic.
    • Node.js: Node.js has been ported to mobile and desktop. It is used in native apps for accessing the Node.js SDK and native addons. Samsung has created Lightweight Node.js. There are also many libraries to expose native app development functionality via Node.js.
  • Summary and conclusion: JavaScript has spread to various devices. There is no one "best" runtime as different contexts have different requirements. Healthy competition is good for the language and developers.
  • Addendum: A few new runtimes were released during writing, including ByteDance's Lynx. The author also omitted some honourable mentions like gjs, MuJS, etc.

Overall, JavaScript has become a versatile language running in diverse contexts, and there is a wide range of runtimes and engines available to meet different needs.

阅读 34
0 条评论