Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish: performance improvments, add piping, fixes #218

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

gazorby
Copy link
Contributor

@gazorby gazorby commented Sep 4, 2023

WHAT

  • Use universal variable to store directories
  • Allow piping to enhancd
  • Reduce type -q calls by storing awk/filter commands in variables
  • Avoid reading the whole input before piping it to the fuzzy finder so streaming works
  • Fix help message not displayed correctly
  • Fix alt+f shortcut not triggering the filter

WHY

Bring feature parity with zsh (piping) and improve overall latency by storing directories in memory instead of a file and freeing up execution time by moving some checks at shell init.

The existing ~/.enhancd/enhancd.log file will be read to fill the variable if it's empty to make the migration seamless.

The rewrite in _enhancd_filter_interactive.fish is mainly due to avoid buffering so we can take
advantage of finders able to stream stdin, like fzf.

Simplistic benchmarks

Here are some benchmarks with the filter disabled for each version.

Log file / variable size: 345
Fish version: 3.6.1
Platform: WSL 1.3.15.0

10 runs

Command:

time for i in (seq 10); enhancd; end

Results:

Latest enhancd (230695f)

________________________________________________________
Executed in    7.51 secs    fish         external
   usr time    0.59 secs    0.19 secs  397.38 millis
   sys time    1.20 secs    1.17 secs   23.02 millis

perf/in-memory-logs

________________________________________________________
Executed in  392.15 millis    fish           external
   usr time  287.06 millis  165.81 millis  121.25 millis
   sys time  124.71 millis  116.80 millis    7.92 millis

500 runs

Command:

time for i in (seq 500); enhancd; end

Results:

Latest enhancd (230695f)

________________________________________________________
Executed in  377.12 secs    fish         external
   usr time   27.87 secs    8.87 secs   19.00 secs
   sys time   60.06 secs   58.44 secs    1.62 secs

perf/in-memory-logs

________________________________________________________
Executed in   22.64 secs    fish         external
   usr time   15.85 secs    9.62 secs    6.22 secs
   sys time    5.36 secs    4.64 secs    0.72 secs

@github-actions github-actions bot added area/fish Catch all for changes in fish files missing/bash Denotes a PR that needs to include changes against missing area labels Sep 4, 2023
@gazorby gazorby changed the title Performance improvments, add piping fish: performance improvments, add piping Sep 4, 2023
@gazorby gazorby changed the title fish: performance improvments, add piping fish: performance improvments, add piping, fixes Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/fish Catch all for changes in fish files missing/bash Denotes a PR that needs to include changes against missing area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant