JavaScript to C++ to faster JavaScript

Today, I am going to try a bold experiment.

Coming up with a JavaScript to JavaScript optimizing compiler.

Optimize for what metric? Performance of code execution (eg. how long does it take to calculate the n-th prime number).

I got started after reading “Is WebAssembly magic performance pixie dust?”, an article by Surma, a Google Developer Advocate. Go check it out, it’s a balanced, thoughtful and well written piece. It takes 3 JavaScript programs, and follows the process of coming up with a faster WebAssembly version (passing via AssemblyScript).

I will try something similar, but targeting directly JavaScript instead of…


Today we are releasing Cheerp 2.6, the latest major release of Cheerp, with plenty of new optimizations and features, and full backwards compatibility.

We are proud to share the advancements and improvements introduced since release 2.5 of our C++ to WebAssembly and JavaScript compiler. In addition to this post, we recently published a recap of the last 8 months of development of Cheerp, including Emscripten’s benchmarks, here.

This post introduces Cheerp, its features, and the problems that can be solved thanks to this tool.


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.


Here at Leaning Technologies we build compilers for the Web (which output a combination of JavaScript and WebAssembly).

Think taking a C++ codebase, feeding it into a LLVM/clang based compiler, and getting something that can to interact with arbitrary JavaScript libraries and the general browser environment. This is Cheerp in a nutshell.

Recently, I have been working on one of Cheerp’s unique features, [[cheerp::jsexport]], a custom attribute that allows to create powerful interfaces between generated and ‘native’ JavaScript. Some cool things now possible thanks to this technology will be shown in this article series. Enjoy!

std::shuffle applied to https://www.google.com/search?q=how+to+shuffle+array

For the last many weeks…


This week I had the chance to attend Mozilla’s conference, where many stakeholders (from big companies to individuals) with an interest in shaping the future of the web met.

The venue, by me

I thought of doing a brief recap of what I got from the event. How fortunate you are.

On stage:

Privacy

Different approaches by the major browser vendors about how to goes around tracking of users by third parties (from “no tracking for all” to “the consumers really want targeted ads, so what should we do, subtract something from the beautiful experience they are having?”).

Plus a powerful warning from Selena Deckelmann that while…


During the last few weeks, I had a few occasions in which I had to explain what I do at work.

Explaining how lucky I feel like and how rewarding it is to work on interesting problems is easy.

xkcd #301, obvious reference

Telling that I spend most of the time at the coffee machine waiting either for recompilations of our codebase or for test results is somehow accurate but a bit too micro. I do also some work on optimizing our compiler results, data-structures, working on the testing infrastructure, or writing documentation.

But what do we do as a company?

There is an…


A few days ago I stumbled upon an article: https://v8.dev/features/bigint on the V8 blog. I had been busy at work with trying to figure out ways to optimize i32 and i64 operations for our C/C++ to JavaScript compiler Cheerp; this seemed like a fun side project to experiment on.

The goal:

Implement a pure JavaScript library, callable by some code like:

var one = BigInt("1");
var A = BigInt("1");
var B = BigInt("1");
for (var i=1; i<=1000; i++)
{
A = BigInt.multiply(A, B);
B = BigInt.add(B, one);
}
console.log("factorial(1000) is " + A);

The plan:

Carlo Piovesan

at Leaning Technologies

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store