I have a very file system intensive function that's being called many times a second. Wish to slow things down a little, anyone knows a way to throttle that function call in elisp?
[EDIT - 04/12/20]:
My Refreshing function calls
projectile-project-p and it's half of my CPU use. As of
- tabbar-buffer-update-groups 156923 55% - let 156923 55% - sort 156923 55% - mapcar 156922 55% - #<lambda 0xcae81b99> 156894 55% - save-current-buffer 156893 55% - list 156756 55% - if 156600 55% - funcall 156600 55% - tabbar-buffer-groups 156599 55% - list 156592 55% - if 156592 55% - cond 155466 54% - projectile-project-p 138487 48% - projectile-project-root 138481 48% - cl-some 138347 48%
While Idle my implementation of the function
tabbar-buffer-update-group is called multiple times a second (like using
> here [210 times] ... 1s > here [247 times] ... 2s > here [293 times] ... 3s
It gets higher when interacting with the interface (cursor moving, tab change, etc).
If i turn off my modifications in Tabbar everything gets so fast...
So: no bug in tabbar or emacs, I did it by myself.
projectile-project-pis too slow for a UI element to call this often. Or is it a bug in projectile?
- I totally should tinker with tabbar hooks and make it refresh only when file is saved of buffer changes. But code isn't that straightforward.
- I totataly should try to customize a more modern implementation, like Centaur Tabs, or I could stop being silly and just stop trying to reimplement perspectives into a tab bar implementation, dunno,
- The best aproach could be a cached return with a time to expire as now it looks a stalled version won't happen.