Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
Deno Slow FS Performance

I've noticed a very noticeably slow performance in reading files in deno, I'm afraid I might be doing it wrong. (kinda stupid?)

const file = Deno.readFileSync(path)

any suggestions? or other faster ways? should I use Deno.run instead? what are the pros and cons of Deno.run in your experience?

Update #1:

I found this module using streams in which it give some more speed, but compared to bash it's very slow:

$ time deno run --allow-read https://deno.land/std@0.126.0/examples/cat.ts movie.mp4 |  wc -l
4066379

real    0m1.890s
user    0m1.608s
sys     0m1.355s

$ time cat movie.mp4 | wc -l
4066379

real    0m0.295s
user    0m0.098s
sys     0m0.372s

$ du -sh movie.mp4 
995M    movie.mp4

Update #2:

Due to the worries of the network speed and Deno launch speed, I made this script where it has them both running respectively:

import {
  copy,
  writeAllSync,
} from "https://deno.land/std@0.126.0/streams/conversion.ts";

const filenames = "movie.mp4";

//########## DENO ############

const before1 = performance.now();

const file = await Deno.open(filenames);
await copy(file, Deno.stdout);
file.close();

const after1 = performance.now() - before1;

const text1 = new TextEncoder().encode(after1.toString() + "\n");
writeAllSync(Deno.stderr, text1);

//########## CMD ############

const before2 = performance.now();

const p = Deno.run({
  cmd: ["cat", `${filenames}`],
});

await p.status()

const after2 = performance.now() - before2;

const text2 = new TextEncoder().encode(after2.toString() + "\n");
writeAllSync(Deno.stderr, text2);

Results in best case:

$ deno run --allow-run --allow-read test.ts >/dev/null
636
82
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Until this moment of writing this comment, I'd like to mention there are no solutions regarding this well-known issue in deno.

There are multiple opened issues in denoland/deno Repository. If there are any updates, I will post an update.

To mention few:

#13720

#10157

#803

#246

#13608

If you find any, please let me know.

Thanks.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda