Cheerp creator: Our C++-to-JavaScript compiler beats Emscripten

Cheerp, a C++ compiler that generates JavaScript code for use in any browser, is being upgraded this week with improved performance, reduced output code size, and  backing for 64-bit integers.

Open source Cheerp, from Leaning Technologies, is based on LLVM, which features a set of modular, reusable compiler technologies. Version 1.2, introduced this week, "comes with some big performance improvements, both in execution time and in startup time," according to a blog post by Leaning Technologies CEO Stefano De Rossi.

Cheerp reached a slowdown of  "only 2 to 6 times compared to native," while still allowing full dynamic memory management and no memory size limitations, the blog states. "Compared with Emscripten in split memory mode, Cheerp is always as fast but most often 2-3 times faster, has a 10-11 times faster startup, requires no effort from the developer to fine-tune compilation parameters, and allows for real dynamic memory management." The rival Emscripten compiler, which also leverages LLVM, converts C/C++ code into the Asm.js JavaScript subset.

In addition to native 64-bit integer capabilities, Cheerp 1.2 supports a PreExecuter capability, currently in an experimental state. "The PreExecuter is a technique that converts C++ code used to initialize global structures into simple data," De Rossi said. "Its main effect is a further reduction of the output JavaScript startup time and a much reduced output code size."

Also new in version 1.2 are Runtime Type Information support, dynamic_cast, and covariant return types. "Cheerp now also experimentally supports the module pattern to isolate generated code from other scripts," De Rossi said.

IDG Insider


« Healthy smartwatch growth seen after slow 2015


16 employee engagement trends that will shake up IT in 2016 »
IDG News Service

The IDG News Service is the world's leading daily source of global IT news, commentary and editorial resources. The News Service distributes content to IDG's more than 300 IT publications in more than 60 countries.

  • Mail


Do you think your smartphone is making you a workaholic?