DISCLAIMER: this document is a work in progress (tests are finished, but results are to be published together with the instructions to carry on them)
With the arrival of a new competitor to the Javascript runtime ecosystem, Bun, I was curious about how fast it is, because one of its selling points is that it is faster than NodeJS and Deno.
So, the idea of this repository, is to test the following Javascript runtime environments:
Runtime | Appareance | Coded in | Estimated usage (*) |
---|---|---|---|
NodeJS | 2009 | C++ | 71% |
Deno | 2018 | Rust (originally in Go) | 8.5% |
Bun | 2021 | Zig | 3.2% |
In order to make the tests more interesting I added 2 fast native environments, C++ and Rust, a classic one like Java (no GraalVM at the moment), and also a "slow" one like Python. Future versions of these tests will include Go and a GraalVM version of the Java test.
Tests are executed from JMeter via some REST APIs.
Language/Runtime | Version | REST Library/Framework used | Version |
---|---|---|---|
Bun | 0.5.9 | Express | 4.18.2 |
C++ | g++ 12.2.1, C++20 mode | Drogon | 1.8.4 |
C# | 11 | .NET | 7.0 |
Deno | 1.33.3 | Express | 4.18.2 |
Java (OpenJDK) | 19.0.1 | Spring boot | 3.0.6 |
NodeJS | 20.1.0 | Express | 4.18.2 |
Python | 3.11.3 | Flask | 2.3.2 |
Rust | 1.69.0 | Rocket | 0.5.0-rc.3 |
For more information about the latest versions check the version.txt file.
The tests are based on the following REST APIs:
Verb | Route | Result | Description |
---|---|---|---|
GET | / |
Fixed little string: e.g. "Deno test" | Very simple API that return a fixed data |
GET | /echo/<data> |
Return the same <data> |
Simple API that return the same received data |
GET | /getPrimesLessThan/<limit> |
Return a list of primes less than <limit> |
CPU and memory are function of the specified limit |
GET | /countPrimesLessThan/<limit> |
Return the number of primes less than <limit> |
CPU is function of the specified limit |
- All tests are coded without tweeking them for performance (CPU, network usage, etc) or memory consumption. The idea is to add tweaks for all examples in the future.
- Currently the only minor tweak is in the Rust application in order to be on pair with C++ (primes functions were hinted as inline).
- For sure there are better ways to test these runtimes/languages, but as an entry point, they could be useful to have an idea of where is each implementation.