domtronn / spaceline-all-the-icons.el

A Spaceline Mode Line theme using All The Icons for Emacs
MIT License
235 stars 25 forks source link

slow performance when opening a file with tramp #34

Open jave opened 7 years ago

jave commented 7 years ago

It seems related to s-a-t-i because I have no performance problems when using plain modeline, and tramp together.

I did some profiling. It seems some functions are called a lot. Shouldnt it be possible to improve performance with memoization for instance? Failing that, can I disable spaceline-all-the-icons--buffer-path perhaps?

jave commented 7 years ago

I tried turning off segments to find a workable setting for tramp buffers, but I couldnt really find any.

also it seemed like projectile-project-p was called even if I turned off that segment.

So I made a little workaround. Revert to standard mode-line when slowness is perceived. The workaround works well, so there is indeed a connection between tramp buffers, spaceline-all-the-icons and slowness.

(defun jv-std-modeline () (interactive) (setq mode-line-format '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position (vc-mode vc-mode) " " mode-line-modes mode-line-misc-info mode-line-end-spaces)) )

domtronn commented 7 years ago

Hi @jave, yep, this is something I've been working on when I get chance. The latest version of all-the-icons include memoization so that should hopefully improve things for you!

Basically, I noticed this because there was a recent change to use the files filename to calculate the icon in all-the-icons-mode-icon segment, which performs a tonne of regexp matches. I've also changed this to use the the files major-mode which is a quick alist assoc.

I don't really use tramp in my day to day, but I can imagine that my buffer-path mode doesn't like it at all, so I could maybe add something to the predicate to disable/change that?

Also, I think Spaceline runs the :when predicates even when the segment itself is disabled, which is unfortunate... So it may mean that the best design pattern is to perform the predicates as part of the main body of the segment if that makes sense?

tl;dr

What version of all-the-icons are you on? Maybe try updating to get the memoization. If you could tell me what kind of behaviour you'd like in a tramp buffer, I can start working on the compatibility with the buffer-path segment

jave commented 7 years ago

I use spaceline-all-the-icons-20170506.408 from melpa. So theres a newer one?

domtronn commented 7 years ago

Nope, that's the latest version, but the library that it depends on (all-the-icons) needs to be 20170513.1019 to get the memoization optimisations.

Which is newer than the latest spaceline-all-the-icons. It's worth just checking that dependency.

However, like you say, there'll probably still be issues with tramp and the buffer-path segment

jave commented 7 years ago

ok, thanks, that dependency was indeed a couple of days older!

SavchenkoValeriy commented 6 years ago

I don't know if this related or not, but Projectile mode-line has a similar problem (with sudo and TRAMP): https://github.com/bbatsov/prelude/issues/594