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 up AppWindow.ProcessTitle #118

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

Conversation

daanzu
Copy link

@daanzu daanzu commented Jun 30, 2018

AppWindow.ProcessTitle was contributing ~90+% of Switcheroo's CPU time whenever its cache was empty/invalidated, due to loading the whole fat Process object just to get the ProcessName, combined with absurdly inefficient implementations in SystemWindow.Process and Process.ProcessName. So, I implemented SystemWindow.ProcessId and SystemWindow.ProcessName directly, reducing my ~5sec time between hotkey & full display to effectively instant.

@elig0n
Copy link
Contributor

elig0n commented Jun 30, 2018

Neat. Did you get that delay every time you pressed the hotkey or just at the first time after launch ?
because 5 seconds sounds unreasonable, is your machine old ?

@daanzu
Copy link
Author

daanzu commented Jul 1, 2018

@elig0n Delay happens first time after launch, and anytime after 1+ hour since last use, because the ProcessName cache entries have 1-hr eviction policy. My machine is fairly beefy, but I must confess to having a habit of keeping a possibly pathological number of windows/processes open. That just emphasized the shamefully quadratic original implementations.

BTW, I like some of your PRs; if they don't get accepted, I might have to pull them.

@milnak
Copy link

milnak commented Aug 30, 2023

FYI, I integrated this change into my fork

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

Successfully merging this pull request may close these issues.

3 participants