seq fallback speedup

Using `string match` instead of `grep -E` resulted in a 2x-3x speedup according
to $CMD_DURATION.
This commit is contained in:
Aaron Gyes 2017-09-22 00:30:26 -07:00
parent fa9e445342
commit 25d83ed0d7

View file

@ -33,7 +33,7 @@ if not command -sq seq
end end
for i in $from $step $to for i in $from $step $to
if not echo $i | grep -E '^-?[0-9]*([0-9]*|\.[0-9]+)$' >/dev/null if not string match -rq '^-?[0-9]*([0-9]*|\.[0-9]+)$' $i
printf (_ "%s: '%s' is not a number\n") seq $i printf (_ "%s: '%s' is not a number\n") seq $i
return 1 return 1
end end