bashlog icon indicating copy to clipboard operation
bashlog copied to clipboard

Optionally Use Faster Programs Like ripgrep?

Open hendursaga opened this issue 3 years ago • 2 comments

I can look for other potential replacements, but I was wondering if you'd be open to considering optionally using tools like ripgrep instead of grep? I see you already look for mawk if it's there.

hendursaga avatar Aug 26 '22 14:08 hendursaga

Grep was only used for the check command to determine whether the (non-standard) options --buffer-size or --parallel are available. The biggest performance impact of the check is starting the sort and grep processes, connecting the pipes, passing and reading the output of sort --help. I would not worry too much about this overhead, as it is in the range of ms, and only executed once per script. In the ideal case the check would be implemented with builtin bash functions.

thomasrebele avatar Aug 27 '22 15:08 thomasrebele

Grep was only used for the check command to determine whether the (non-standard) options --buffer-size or --parallel are available.

Apologies for the bad example.

One potential optimization would be to change --parallel=2 to something like --parallel=$(nproc), or is nproc not sufficiently POSIX or whatnot?

https://github.com/thomasrebele/bashlog/blob/92065192ee44655ffdd4ecdc662311d33fc9e091/src/main/java/bashlog/BashlogCompiler.java#L123

hendursaga avatar Aug 27 '22 19:08 hendursaga