New compilers convert native code to JavaScript

Source: Internet
Author: User
Tags emscripten

Guide: The Emscripten-C + + to JavaScript project leverages the backend from LLVM to build a faster and more targeted compilation solution.

When it was announced, Emsripten sounded like a full-on technology joke: A compiler that translates C + + code into Asm.js, and its processing can run as a subset of JavaScript through a Web browser or in the node. JS Framework.

But it turns out that it's not a joke. Emscripten and Asm.js, a research project originally initiated by Mozilla, have evolved from the day they were born, and have finally made impressive strides. The latest technical result is that the new version of Emscripten replaces the original mechanism with the compiler core from LLVM-the compiler technology framework was originally intended primarily for the C/s + + environment, but could theoretically support many other languages.

According to the developers of the Emscripten project, instead of choosing LLVM, Emscripten brings a number of new advantages. First, the entire compilation process is faster-"it usually leads to a four times-fold or even higher conversion efficiency," they point out, and the amount of memory required for the conversion is reduced. This replacement also "avoids the occasional unpredictable slow-down phenomenon of the original compiler." "More importantly, the LLVM backend allows Emscripten and LLVM to achieve docking in a much tighter way.

The only downside to using LLVM is that it has to be properly recompiled to work with Emscripten. The results of LLVM's treatment can only provide us with some of these advantages, and it is difficult to bring them into full play unless there are other options.

Asm.js is still widely regarded as an experimental technology, and only Mozilla Firefox is the only browser that can support it directly. But its actual performance is still impressive. Just recently, Asm.js successfully ported unreal game engines to JavaScript, allowing the platform to run directly in the browser without any plug-ins or non-native code mates.

Google has yet to decide whether to provide full support for asm.js, but Chrome has determined to be open to the JavaScript apps it generates-although the level of speed is far from being the same as Firefox. Google's plan appears to be to use the Dart language as a near-native code execution speed scheme for the browser platform, but the popularity and flexibility of JavaScript still has a significant advantage at least for the time being, and dart may find it difficult to gain a competitive advantage in a short period of times.

Reproduced in original: 51CTO

English Original:http://www.infoworld.com/t/javascript/new-compiler-cranks-javascript-native-code-240923

New compilers convert native code to JavaScript

Related Article

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.