mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
93f8385448
I've often needed a way to get the last bit of performance out of unwieldy completions that involve a lot of string processing (apt completions come to mind, and I ran into it just now with parsing man pages for kldload completions). Since many times we are looking for just one exact string in the haystack, an easy optimization here is to introduce a way for `string match` or `string replace` to early exit after a specific number of matches (typically one) have been found. Depending on the size of the input, this can be a huge boon. For example, parsing the description from FreeBSD kernel module man pages with zcat /usr/share/man/man4/zfs.4.gz | string match -m1 '.Nd *' runs 35% faster with -m1 than without, while processing all files under /usr/share/man/man4/*.4.gz in a loop (so a mix of files ranging from very short to moderately long) runs about 10% faster overall with -m1. |
||
---|---|---|
.. | ||
collect.rs | ||
escape.rs | ||
join.rs | ||
length.rs | ||
match.rs | ||
pad.rs | ||
repeat.rs | ||
replace.rs | ||
shorten.rs | ||
split.rs | ||
sub.rs | ||
transform.rs | ||
trim.rs | ||
unescape.rs |