Cheerp 2.6 rc1: C++ compiled for the Web
Today we are proud to announce that we are close to finalizing the release of Cheerp 2.6.
Many improvements have been added to Cheerp in the last 8 months (compared to the previous release) by our team, and now it’s all packaged to be used on the C/C++ codebases you have at hand.
In this post, I will go through the new features of Cheerp 2.6, how to use it, and present some benchmarks and live examples.
Applications compiled with Cheerp are compact and performant (see benchmarks later in the article) and can be executed sandboxed by the client browser locally, without requiring any server components but only serving 2 static files.
Cheerp supports all modern browsers (even Internet Explorer 11 thanks to an opt-in asmjs-based solution), with the possibility of enabling WebAssembly extensions by command line.
What’s new? JSExport
Free standing functions can be exported with a wider range of parameter kinds, and now also classes and namespaces can be exported.
Using JSExport it’s just a matter of adding the tag
[[cheerp::jsexport]] to the definition of all relevant classes and functions.
(original article: link)
What’s new? Delayed Int64 lowering
The lowering of 64 bit integers has been moved from the very start of our compilation pipeline to an intermediate position.
This allowed many improvements of the WebAssembly backend, to name two major ones: a speed-up of 64 bit math-intensive workloads, and an improved code generation of the
memmove intrinsics (from 4 byte/instruction to 8 byte/instruction).
(original article: link)
What’s new? ExternRef
ExternRef it’s an important stepping stone toward a full fledged garbage collection in WebAssembly (see proposal).
(original article: link)
What else is new?
In the 450+ commits from our latest release there is also plenty of work directed at fixing problems encountered on the way (e.g. improving code generation in various sub-cases, for example via a more aggressive switch lowering, or avoiding indirect calls in some cases).
Cheerp is a LLVM-based compiler, leveraging plenty of state of the art optimizations available there. Cheerp is currently based on clang 9.0, and supports the C++17 standard.
How to try it out
Cheerp 2.6 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.
How to upgrade your project to Cheerp 2.6
Cheerp is fully backward compatible with its previous versions, but intermediate compilation artefacts might not be, so it should just be a matter of going to your Cheerp build folder and running
make clean && make && make install
You should now experience a smaller footprint and improved performance without any change required neither on your codebase nor in the way your code is built or integrated.
You can also now enjoy the newer JSExport capabilities, we recommend to start from the main article about it.
This release will be a month long process where we will both gather feedback from our users and do additional rounds of testing, fixing any problem that might emerge in the process, before finalizing version 2.6.
Part of our release process is checking Cheerp’s output on the Emscripten’s benchmark suite.
We focus our attention on the four bigger and more complex benchmarks:
- Box2d: a 2D rigid body simulation library
- Bullet: a 3D physics engine which simulates collision detection, soft and rigid body dynamics
- Zlib: a lossless data compression library
- Lzma: another lossless data compression library
We compared with the latest Emscripten release, 2.0.9.
These numbers have been extrapolated on a single benchmark environment (MacBook Pro, Linux x86_64, TurboBoost disabled), and averaged across three repetitions. Similar results hold on all of our benchmark machines.
Cheerp’s outputs outperform Emscripten’s outputs by roughly 5%.
Cheerp is a combination of an industry standard compiler (clang) with its own state-of-the-art optimization passes (PreExecuter, Registerize, GEPOptimizer, CFGStackifier, Devirtualization, and various others).
Cheerp is tried and tested on extremely complex code bases, and is backed by a strong technical team that can provide support and advice.
Cheerp in use
While Cheerp is used primarily in commercial applications that are not publicly accessible, one great example of a public-facing Cheerp application is HomeByMe by 3DVia, a subsidiary of Dassault Systèmes. You can try out their purely client-side 3D home design CAD solution directly from your own browser visiting: https://home.by.me/en/.
They took a complex C++ codebase and compiled it for the Web, allowing to offer a more responsive and easier to manage cross platform solution to 3D cad.
Cheerp is also the cornerstone of two other tools developed at Leaning Technologies:
Leaning Technologies is a technology company extensive experience in solutions for the Web as a platform.
With Cheerp 2.6, we deliver a mature tool that allows to unlock your C++ code bases and bring them to the Web. Update your Cheerp version, or try it for the first time getting started on our documentation.