Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

103
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda