Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deno performance compared to node.js

Deno uses v8 to execute javascript but considering the fact that it directly runs typescript, I'm wondering if there is a performance penalty because of it or not.

It seems it compiles the code only for the first time. So is it possible to compile as a deployment step and avoid the startup overhead related to compilation?

Is there any other aspect in performance comparison between node.js and Deno?

like image 218
Alireza Mirian Avatar asked May 07 '20 16:05

Alireza Mirian


2 Answers

Deno keeps track of some key performance metrics here: https://deno.land/benchmarks

As far as pre-compilation, it's on the roadmap and tracked in this issue: https://github.com/denoland/deno/issues/986

like image 173
Matt Landers Avatar answered Nov 10 '22 13:11

Matt Landers


(an answer to the 2nd paragraph)

Deno stores the compiled assets in DENO_DIR. You can check it with the command "deno info". If you deploy the entire DENO_DIR as well as your source code, you can avoid the TypeScript compilation at the startup time.

You can also change the location of DENO_DIR by setting the DENO_DIR environmental variable.

DENO_DIR=/path/to/your_deno_dir deno run entrypoint.ts
like image 43
kt3k Avatar answered Nov 10 '22 14:11

kt3k