mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 13:08:49 +00:00
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:
parent
fa9e445342
commit
25d83ed0d7
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
# If seq is not installed, then define a function that invokes __fish_fallback_seq
|
||||
# If seq is not installed, then define a function that invokes __fish_fallback_seq
|
||||
# We can't call type here because that also calls seq
|
||||
|
||||
if not command -sq seq
|
||||
|
@ -33,7 +33,7 @@ if not command -sq seq
|
|||
end
|
||||
|
||||
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
|
||||
return 1
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue