babakfp
babakfp•9mo ago

Trying to benchmark `Deno.remove` but it fails

deno bench --allow-write bench.ts
Check file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts
cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
runtime: deno 1.36.4 (x86_64-pc-windows-msvc)

file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts
Deno.remove error: NotFound: The system cannot find the file specified. (os error 2): remove './assets'
await Deno.remove("./assets", { recursive: true })
^
at async Object.remove (ext:deno_fs/30_fs.js:201:3)
at async file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts:2:5
error: Bench failed
deno bench --allow-write bench.ts
Check file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts
cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
runtime: deno 1.36.4 (x86_64-pc-windows-msvc)

file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts
Deno.remove error: NotFound: The system cannot find the file specified. (os error 2): remove './assets'
await Deno.remove("./assets", { recursive: true })
^
at async Object.remove (ext:deno_fs/30_fs.js:201:3)
at async file:///C:/Users/babak/OneDrive/Desktop/deno-benchmark-345654/bench.ts:2:5
error: Bench failed
6 Replies
ioB
ioB•9mo ago
The benchmark runs the code several times In this case, it ran it once, deleted the folder, and ran it again and found no folder to delete You need to re-add the folder every time
babakfp
babakfp•9mo ago
Aha Thanks for that. Is there a way to tell it to run only once?
NDH
NDH•9mo ago
just use performance.now() for single test
ioB
ioB•9mo ago
you cannot get an accurate benchmark off of one deletion, so no, but you can do what @BuenoFan suggested
NDH
NDH•9mo ago
const start = performance.now();
// do something
const took = performance.now() - start;
const start = performance.now();
// do something
const took = performance.now() - start;
babakfp
babakfp•9mo ago
Alright, thanks guys 🌸🌸
More Posts
Plot Vega-Lite in Jupyter Notebook running the Deno kernelHello, I am very new to Deno... I wanted to see if I can produce some interactive Vega visualizaitonSegfault when creating second rust MainWorker in programHello. Not sure if this is the place to ask since it seems to be a v8 issue (or perhaps an issue wiHow can I use "Logging with colors" with `"npm:log-update"`Hi https://examples.deno.land/color-logging I don't want to use Chalk because it's not properly typeHow to uploading images from frontend to Deno.serve()Hey, can someone please give me a vanilla code example on how to upload files from my frontend applDeno Deploy JSON importI'm using zod-i18n-map library for error translation, which requires an import for the library itselMost efficient way to broadcast messages globally across main script and workers?I basically want a simple message bus that is global to all my workers + the main script, without reWhat is the process for deploying a jupyter notebook made using deno?I have webdev experience and was using Observable. I was looking for alternatives that use javascripPostGraphile on DenoDoes PostGraphile work with Deno? Trying to see if I can run PostGraphile as a serverless function oIs there any way to disable Deno's Intellisense feature without disabling Deno itself?When programming with Deno, I've noticed how relatively slow the lang server is, and I need intellisDeploying Lume to github pagesI'm totaly new to this, but have been following instructions to build a site with lume. It works loc