deno icon indicating copy to clipboard operation
deno copied to clipboard

reduce readFileSync syscall count

Open littledivy opened this issue 1 year ago • 2 comments

https://x.com/justjs14/status/1791963104881844360

image

Repro: https://gist.github.com/billywhizz/1d6fee4d3aea1030324a7a93de444d31

littledivy avatar May 19 '24 03:05 littledivy

Its probably due to permissions check, I think in the case of read when comparing paths deno need to canonicalize and normalize the paths, to know its allowed or not

Maybe absolute flags (as in --allow-read instead of --allow-read=path, etc) should not suffer the sandbox performance hit, since they can work in theory with just an extra boolean check and more importantly with no extra syscalls

sigmaSd avatar May 21 '24 18:05 sigmaSd

It's a regression from #23208

This getcwd code path should never reach with --allow-all and generic --allow-read https://github.com/denoland/deno/blob/fabd9a214b278bb119818187de66121c5f91b751/ext/fs/std_fs.rs#L904-L905

littledivy avatar May 22 '24 09:05 littledivy