Deno vs Node.js: Performance comparison: Generate 100 v1 UUIDs

Mayank C
4 min readSep 16, 2020

The performance comparison is updated for Deno v1.9 and Node v15.14 here: https://mayankchoubey.github.io/Deno-vs-Node-Performance/. The medium doesn’t allow updating posts through API, so this article would be updated later.

This is a series of articles that compare the performance of Deno and Node.js by running various commonly used scenarios. The reliability of Deno is another aspect that will be addressed in another series.

This is part 4 of the performance comparison series. The other parts of the series are:

The first three parts in this series focused more on async operations. The first part was about hello world using native code. The second part was about hello world using frameworks such as oak and express. The third part was about echoing the name over HTTPS. All of these are mostly async ops.

In this part of the performance comparison series, the focus would be on CPU intensive operations. Generation of a UUID is a very common work in modern apps. The same idea is extended to a program that would generate 100 v1 UUIDs and return them in a JSON array. This is very CPU intensive work, and it’d be interesting to see the comparison.

For this performance testing, a very simple performance tester has been used that runs in Deno. No extra installation required. The performance tester takes all the inputs from the command line and runs the test. It allocates workers that continuously hit the server for the specified number of requests.

Here is the code for both Deno and Node.js:

Deno code is here. Node.js code is here.

Environment: The performance test is executed on MacBook Pro with 8G memory and Quad-core i5 processor. The benchmarker and SUT, both runs on the same machine. There is no network delay.

Versions: Here are the Deno and Node.js versions used for performance comparison.

The performance test is executed for different values of concurrent connections with the same value of repeat. Here are three scenarios:

  • 1 concurrent connection and 1000 repetitions
  • 10 concurrent connections and 1000 repetitions
  • 25 concurrent connections and 1000 repetitions

The following readings were taken: Total time taken, mean, median, min, and max.

TEST RESULTS

Concurrency=1

Here is the overview of the results:

And, here is the detailed distribution (10% quantiles) of the readings:

Here are the graphs:

Concurrency=10

Here is the overview of the results:

And, here is the detailed distribution (10% quantiles) of the readings:

Here are the graphs:

Concurrency=25

Here is the overview of the results:

And, here is the detailed distribution (10% quantiles) of the readings:

Here are the graphs:

Analysis

Deno is consistently slower than Node.js for CPU intensive operations.

--

--

Mayank C
Mayank C

Responses (2)