cbdr icon indicating copy to clipboard operation
cbdr copied to clipboard

Avoid calling shell

Open pacak opened this issue 1 year ago • 2 comments

Unless you are trying to bench command with some shell redirects - you can split arguments yourself with this and call a command by hand.

https://docs.rs/shellwords/latest/shellwords/fn.split.html

pacak avatar Oct 08 '24 01:10 pacak

Yeah, we could do this. It would have the bonus advantage of making it work (sometimes) on windows.

For the record, on my system, spawning /bin/sh takes 0.853 ms (± 0.089). So although this is overhead added to every benchmark, it's small and low-variance.

asayers avatar Oct 08 '24 07:10 asayers

So although this is overhead added to every benchmark

It's better to compare X vs Y than X+0.8 vs Y+0.8. Plus on Windows process spawning overhead is 10 times that of Linux. Dunno about Mac.

pacak avatar Oct 08 '24 10:10 pacak