Cheerp 2.0 released — the most powerful Cheerp yet
Today we are proud to announce the release of Cheerp 2.0, the culmination of 4 years of improvements and optimisations and our biggest release yet since Cheerp 1.0 in 2014.
Cheerp is the most advanced and flexible solution to bring C++ code to the Web. It is based on the industry-standard Clang/LLVM stack, and provides a robust workflow with sensible defaults, clear error messages and gcc-like command-line options that allow for an easy integration in IDEs and continuous integration environments. Cheerp runs on Windows, macOS and Linux, making it possible for C++ developers to create Web application in a seamless manner on their system of choice.
New Features of Cheerp 2.0
Cheerp 2.0 also introduces a new set of improved optimisation steps, targeting both improved runtime performance as well as reduced output size. In this regard, one of the most significant changes is the introduction of the CFGStackifier algorithm. As a result, Cheerp 2.0 generates WebAssembly code that is at least as fast but usually faster than Emscripten, and typically smaller in footprint.
CFGStackifier — better structured control flow reconstruction
To a large extent, Relooper is a proof-of-concept algorithm, which can always compute a working solution, but not necessarily the optimal one, due to unnecessary restrictions imposed to the structure of the output flow. It does work reasonably well on many common cases, but over the years, we found significant inefficiencies in the compiled control flow on the complex commercial codebases (such as videogames and CAD software) that Cheerp is used on.
CFGStackifier has many interesting technical details and we plan to publish one (or maybe two) blog posts about it in the future. This new algorithm is stable and enabled by default in Cheerp 2.0, but we also allow users to select the old Relooper based solution by using the command line option -cheerp-cfg-legacy.
DOM manipulation and WebAPI access from WebAssembly — mixed-mode Cheerp
[[cheerp::genericjs]] — to determine how they will be compiled. As an example, see this code snippet which can be compiled to WebAssembly:
Any method tagged with
What you can do with Cheerp
Cheerp is a powerful, flexible and robust tool, which can be used in multiple ways:
Convert existing C++ application to Web applications: Cheerp can recompile any large scale C++ application into an HTML5 web application, allowing you to provide your users with a modern, cloud integrated user experience with minimal interventions on the core business logic.
Compile native C++ games to HTML5: Cheerp allows you to quickly port your C++ game to the web, with no code rewriting. Modern web browsers are powerful gaming platforms, including 3D graphics (through WebGL), programmable sound pipeline (through WebAudio) and motion sensors (accelerometers and GPS). You can use Cheerp to convert full games or to offer a playable teaser trailer or demo than can be started with a single click.
Convert C++ libraries and integrate them into HTML5 applications: as a general rule, if you have a problem, there is a C/C++ library (either open source or proprietary) that will solve it.
Cheerp add-ons (commercial users)
As part of our offering for commercial users we provide several proprietary add-on libraries, designed to simplify porting and debugging of complex applications using Cheerp.
The main add-ons for Cheerp currently available are:
- libposixcompat: Provides additional compatibility with POSIX functions such as filesystem and timing APIs. For more info see here.
- libemscompat: Provides partial compatibility with Emscripten APIs, to simplify migrating projects to Cheerp.
Detailed performance benchmarks will be provided in a dedicated blog post. A summary of runtime performance and output size, focused on WebAssembly, is provided in this post.
Runtime performance — Firefox
On Firefox’s SpiderMonkey engine, Cheerp 2.0 WebAssembly output is on average 36% slower than native, ranging from 1.13x times native speed to 2.45x native speed depending on the specific benchmark.
On average, WebAssembly code generated by Cheerp 2.0 is 9% faster than the one generated by Emscripten (best case: Cheerp 29% faster, worst case: same speed).
Runtime performance — Chrome
On Chrome’s v8 engine, Cheerp 2.0 WebAssembly output is on average 80% slower than native, with Chrome therefore seeming overall slower, and a lot more variable, in executing WebAssembly code compared to Firefox.
On average, WebAssembly code generated by Cheerp 2.0 is 5% faster than the one generated by Emscripten (best case: Cheerp 11% faster, worst case: Emscripten 2% faster).
The output of Cheerp 2.0 is on average 20% smaller compared to Emscripten (best case: Cheerp 44% smaller, worst case: Emscripten 2% smaller).
Getting started with Cheerp 2.0
Cheerp 2.0 is available for Windows, macOS and Linux from https://leaningtech.com/cheerp/download/.
To get started with Cheerp, please visit the main Documentation page. You will find instructions on how to download, install and use Cheerp, as well as step-by-step tutorials.
Tested on millions of lines of code, chosen by many commercial products, Cheerp is the best technology to enable complex, large-scale applications to be converted to a Web application.
For more information on how Cheerp can help your organization to leverage your existing C++ code to develop HTML5 web applications that work on any device, with no need for plug-ins or download, please check out our website at https://leaningtech.com/cheerp/.