Collects all pages using single invocation of base name instead of invoking basename for all individual page
What does it do?
Replaces multiple (now 2400+) invocations of basename with the single one.
Why the change?
Change prevents freezing of console when user presses <TAB> by dramatically decreasing time to lookup page files:
Before:
❯ time find $HOME/.tldrc/tldr/pages/common -name '*.md' -exec basename {} .md \; >/dev/null
find $HOME/.tldrc/tldr/pages/common -name '*.md' -exec basename {} .md \; > 1.51s user 3.58s system 36% cpu 14.076 total
After:
❯ time find $HOME/.tldrc/tldr/pages/common -name '*.md' -exec basename -s .md {} + >/dev/null
find $HOME/.tldrc/tldr/pages/common -name '*.md' -exec basename -s .md {} + > 0.00s user 0.01s system 22% cpu 0.047 total
How can this be tested?
Change can be tested by invoking autocompletion in Zsh: enter tldr and press tab key.
Zsh autocomplete file should be sourced before testing: source autocomplete/complete.zsh
Collects all pages using single invocation of base name instead of invoking basename for all individual page
What does it do?
Replaces multiple (now 2400+) invocations of
basename
with the single one.Why the change?
Change prevents freezing of console when user presses
<TAB>
by dramatically decreasing time to lookup page files:Before:
After:
How can this be tested?
Change can be tested by invoking autocompletion in Zsh: enter
tldr
and press tab key. Zsh autocomplete file should be sourced before testing:source autocomplete/complete.zsh
Where to start code review?
Single line change so it is self-explanatory
Relevant tickets?
None
Questions?
None