Facebook developers design Hermes to push cross-platform JavaScript at divine speeds • The Register



[ad_1]

Facebook on Thursday released a JavaScript engine called Hermes under an open source MIT license to improve the performance of native React applications.

The announcement was announced at the 2019 Chain React conference, focused on developing React Native. React Native is an open source mobile applications framework created by Facebook to develop applications for Android, iOS and the Universal Windows Platform (UWP) using JavaScript, React (a library of 39; JavaScript interface) and native platform components. The supposed benefit is that developers can target all three mobile platforms with a single code base; but as in any multiplatform framework, there are compromises in terms of performance, security and flexibility.

Hermes aims to address the performance trade-off, which is particularly important for Facebook, due to the complexity of JavaScript-dependent mobile applications. The amplified engine is designed to reduce the time to interaction, the delay between the launch and the usability of applications, a particularly important measure for consumer application manufacturers, application size and the size of the application. memory usage.

As observed by Google's technical manager Addy Osmani, Google's V8 JavaScript engine spends a lot of time analyzing and compiling JavaScript code before running it, slowing down the startup of mobile applications. According to Osmani, the phases of analysis and compilation that precede the execution of machine-specific machine instructions can be two to five times longer on mobile devices than on desktop devices.

Hermes is designed as an alternative to Google's V8 (Chromium), Apple's JavaScript, Mozilla's SpiderMonkey, and ChakraCore, Chakra's open source version of Microsoft. left behind for V8 in Redmond based on the resurrection of its Edge browser based on chrome.

But for now, this is only an alternative in the context of native React applications. Hermes has not been adapted to other projects based on JavaScript engines, such as Node.js or frameworks such as Electron (cross-platform applications using JavaScript alongside web-based technology rather than Web-based applications). To the native code) integrating Chromium.

javascript

JavaScript tracking by punks has been swept away by good old-time server log analysis

READ MORE

According to Facebook, there is no plan to push Hermes beyond React Native to Node.js or to make it the base of a Facebook brand browser. Indeed, it is optimized for mobile applications and does not offer advantages over other engines in other scenarios of use.

Hermes tries to be effective thanks to the precompilation of bytecode. Rather than loading JavaScript and then analyzing it, Hermes uses a compilation in advance (AOT) during the build process of the mobile application to allow further optimization of the bytecode. In the same vein, the Fuchsia Dart compiler for iOS is an AOT compiler.

There are other ways to get more performance from JavaScript. The V8 engine, for example, offers a feature called custom snapshots. However, this is a little more technically demanding than using Hermes.

Hermes also throws the Just In Time (JIT) compiler used by other JavaScript engines to compile code that is frequently interpreted into machine code. In the context of React Native, JIT does not do much to lighten the workloads of mobile applications.

The reason why Hermes exists, as Facebook says, is to improve React Native. "Hermes allows more optimization on mobile because developers control the building stack," said a spokesman for Facebook in an email to the address The register. "For example, we implemented bytecode precompilation to improve performance and developed a more efficient memory recovery function to reduce memory usage."

Facebook, said a spokesman for the company, plans to publish benchmark numbers to back up its performance statements next week. In a discussion on Hacker News, Microsoft developer Andrew Coates claims that Hermes and React Native's internal tests in conjunction with Microsoft Office for Android show that TTI uses Hermes at 1.1s, compared to 1.4s for V8 and with 21.5MB impact on runtime memory, compared to 30MB with V8.

Hermes is mainly compatible with JavaScript ES6 but not completely. To keep the engine small, some language features, such as instructions and local mode, are missing. eval ().

A developer who works for a Facebook rival said The register that the success of Hermès remains linked to the success of React Native, unless the learning of the compilation on platforms other than Android is taught. And in the foreseeable future, it can be expected that browsers will continue to use C ++ -based executions for performance and portability reasons. ®

Sponsored:
Balance consumption and control of companies

[ad_2]

Source link