On Wed, Oct 14, 2020 at 10:46:15AM -0700, Junio C Hamano wrote: > > I like that you allow regexes. It's unfortunate that the skip-check > > costs us a process in every test. It may not be that big a deal since we > > only pay it if you use a non-numeric selector. But I wonder if there's > > any reason not to use "expr" here, as well. > > If you define the pattern is not regexp but is glob, you can use > case/esac to do this without any forking. Yes, that would probably be OK for most purposes, though I admit my real love for regex support is the ability to use "." instead of space to avoid quoting arguments. ;) Globs may make some real patterns slightly simpler, though. I imagine that the "setup" example may need to be "set.?up" or "set.*up" in practice. Which is only "set*up" as a glob (I also don't have a problem standardizing on one spelling as people find cases). > Your expr may well be built-in, though. Yeah, that was my assumption, though I didn't bother to test it. Having done so, it looks like it's not a built-in either in dash or bash. So switching to it from grep may be buying less in practice than I thought. We're also running a ton of exprs earlier in the function. Running: strace -f -e execve -o foo.out ./t0003-attributes.sh --run=10 appears to exec expr 65 times. There are only 103 execves total in the whole run, so that's more than half of them! It might be worth seeing if some of those could do globbing via case/esac. Repeating without "--run" yields 39 exprs out of 492 execs. So that's less abysmal. Most of those are from test_oid_cache. -Peff