Cheerp 2.5 released
Best-in-class C/C++ to WebAssembly compiler
Today we announce the release of Cheerp 2.5, the first major release of the Cheerp compiler after the release of 2.0 — the first release to support WebAssembly — one year ago. This follows our release candidate of April 8th, announced here.
While also based on the LLVM/Clang stack, Cheerp does not rely on the LLVM WebAssembly backend, as Emscripten does. Cheerp is based on a custom extended Clang frontend and a custom LLVM backend.
With Cheerp 2.5, we make significant steps forward in terms of performance, making Cheerp the best performing C/C++ compiler for WebAssembly, both for compiled size and execution speed.
Cheerp 2.5 introduces experimental support for WebAssembly reference type
New in Cheerp 2.5
Note: most of these new features were discussed in our previous release candidate post.
Cheerp 2.5 is the first major release of Cheerp since 2.0, the first to introduce support for WebAssembly. Cheerp 2.5 introduces support for WebAssembly reference type
anyref, and is mostly focused on quality-of-life improvements, cleaner code generation, and faster build times.
Cheerp is based on the LLVM/Clang framework. Since Cheerp 2.0, we have started a long term modernization effort to bring Cheerp fully on par with the upstream LLVM/clang project. The 2.5 release includes a first big step in this effort, as Cheerp has been rebased from LLVM/Clang 3.7 to the 6.0 version.
Further rebase work will continue in the next releases of Cheerp, to finally rebase it on up-to-date LLVM/Clang. We are doing this progressively to make sure no regressions are introduced, for the sake of both the end-users of Cheerp, and our other products CheerpJ and CheerpX, which rely heavily on Cheerp.
Interoperability with the host environment
Cheerp allows classes and functions to be tagged with optional attributes such as
In WebAssembly mode, code runs faster but has limited access to browser APIs. This is the default compilation mode followed by Cheerp.
[[cheerp::genericjs]]attribute, or on the whole code base with a compile-time flag.
Cheerp 2.0 was the first release to provide this level of interoperability, but it’s the new 2.5 release that truly delivers on this promise. This feature support is now battle-hardened by one year of testing from our users and our other tools based on Cheerp.
Experimental support for anyref
Note: a technical post will be published soon providing an in-depth analysis of Cheerp support for
anyref, a WebAssembly application that needs to interact with the DOM needs to use methods tagged with
[[cheerp::genericjs]]. We know from experience that this is not a problem in practice, but can be a little cumbersome for very short sections of code.
anyref support, it is now possible to directly interact with the DOM from WebAssembly sections of code (usually, the whole source, or
Compilation time has also been significantly reduced, especially for large codebases.
The PreExecuter, one of Cheerp’s custom optimisations, is now mature and fast enough to be recommended for any build (just add
Cheerp 2.5 also introduces reproducible builds, which will simplify debugging. If you run the compiler twice on the same input code, the output will be the same.
Many small improvements to WebAssembly code generation have also been implemented, which together sums up to an impressive reduction in code size, for the same (or better) performance.
To name a few interventions:
- Globalization. Cheerp now takes advantage of WebAssembly globals to encode constants and global data when convenient.
- Improved GlobalDCE. Cheerp now removes global data which, even if modified, does never alter the observable state of the program.
Cheerp 2.5 includes several quality-of-life improvements for our users. The command-line options have been simplified and now WebAssembly is generated by default. Old command-line options are still fully supported and internally mapped to the new ones, for compatibility with existing build scripts.
Note: a detailed performance comparison with Emscripten was provided in our previous release candidate post (Cheerp 2.5-rc1). Benchmarks for Cheerp 2.5 lead to extremely similar results.
With every release of Cheerp, we commit to ensure that the compiled WebAssembly output is best in class in terms of build size and performance. Cheerp 2.5 continues to maintain this commitment with on average smaller builds compared to the latest release of Emscripten, even when the Emscripten
MINIMAL_RUNTIME is enabled. On both Firefox and Chrome, WebAssembly code generated by Cheerp is 5–6% faster than Emscripten.
Getting started with Cheerp 2.5
Cheerp 2.5 is available for Windows, macOS and Linux. 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.
Cheerp 2.5 is the first major version of Cheerp after 2.0 was released one year ago, the first version of Cheerp supporting WebAssembly.
Cheerp 2.5 adds support for
As with any release, Cheerp 2.5 introduces significant size and performance optimisations, maintaining Cheerp as the best-in-class tool for WebAssembly generation.
Cheerp 2.5 is a highly-optimised, robust, enterprise-grade WebAssembly compiler ready for applications of any scale.
Get in touch
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.
Follow us on twitter or drop us a line on Gitter! For additional technical information on Cheerp, please visit our wiki or our tech blog.