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

Speed: potentially integrate multiple find calls and (maybe) do away with grep. #56

Open
gdevenyi opened this issue Apr 4, 2024 · 2 comments

Comments

@gdevenyi
Copy link

gdevenyi commented Apr 4, 2024

ssh-find-agent is 50% of my shell startup time

Clearly a lot of time is spent at
https://github.com/wwalker/ssh-find-agent/blob/master/ssh-find-agent.sh#L76-L84

Where find is called multiple times against multiple paths.

I think we can do better:

  1. Use the -o syntax of find, https://superuser.com/questions/1494617/what-is-the-o-argument-in-find-command
  2. Potentially adjust the existing find calls to do away with the post-grep (although you can instead combine the grep into a single one)

I'm going to look into how this works, but find is black magic and difficult, so I'm stating my intention here.

@wwalker
Copy link
Owner

wwalker commented Apr 15, 2024

I pushed a possible fix to 56-draft. I'll use it a few days and see where it leads.

@wwalker
Copy link
Owner

wwalker commented Apr 15, 2024

@gdevenyi

For me, with 12 live ssh-agent sockets, running time ssh-find-agent yields ~80 to 120 ms. If it takes significantly longer for you, I suspect that you will find the actual time is being spent in line 90 talking to dead sockets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants