jrmoulton / tmux-sessionizer

Tmux Sessionizer: A tool for opening git repositories as tmux sessions
MIT License
459 stars 35 forks source link

`tms` command got really slow #95

Closed brumik closed 7 months ago

brumik commented 7 months ago

Hello. I was using tms for a while now in nix. I was using the latest stable release of tms and running tms took me usually less than a second (I specified only 2 folders to search in and I have less than 15 git projects locally).

When I changed something in the shell (added direnv) I seen a huge increase in load time for running tms. It takes up around 8s to load the options. I of course tried to roll back to my previous config and rebuild the system, but the issue remained. Then I tried to upgrade to the latest version (unstable channel) and migrated my default-config.toml to config.toml. Still, the issue persist.

Do anybody has a clue what could have happened and potentially how to fix it? I do not understand rust well enough and no idea what change in tms or in my system could have happened.

jrmoulton commented 7 months ago

I don't think the issue is direnv. Can you try setting the --max-depths to 1?

that way if you have folders with lots of subfolders/files it won't search them.

brumik commented 7 months ago

This actually helped, though I have only top level git repositories in these directories. I tried to disable submodules which I expected to make the search stop if hit a git repository. Maybe I am mistaken, but should not tms stop the depth search when hitting a git repository?

search_submodules = false
recursive_submodules = false
brumik commented 7 months ago

What I have example:

I think there should be a stop in search when it hits a git repo. So doing

search_submodules = false
recursive_submodules = false

[[search_dirs]]
path = "/home/user/Documents"
depth = 10

should be the same complexity as

[[search_dirs]]
path = "/home/user/Documents"
depth = 1

[[search_dirs]]
path = "/home/user/Documents/Work"
depth = 1

[[search_dirs]]
path = "/home/user/Documents/Personal"
depth = 1
jrmoulton commented 7 months ago

https://github.com/jrmoulton/tmux-sessionizer/blob/56c0b1c0cad01f56446d0fa65d246a2679d42f48/src/repos.rs#L64C9-L93C10

The logic is for it to stop after finding a git repository so I'm not sure what would be happening in your case

brumik commented 7 months ago

It looks sound. I do not know what happened but with the workaround I can work. I think we can close this issue unless you want to keep it open. I might be able to do some debugging later if I manage to setup development tms.

Thank you for the help.