syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.68k stars 4.89k forks source link

Improving Performance #1114

Closed fasddag closed 8 years ago

fasddag commented 9 years ago

This must be a common question, but I could not find an answer: how do I improve spacemacs performance?

I suspect I do not need or use most of the functionality, because I do not know about it. Things like auto-completion, line-highlight, linum (whatever that is), smooth scrolling, spell check? In fact, I'd give up things that are useful just to speed things up.

Perhaps, someone could share their init file with all the fancy things disabled?

synic commented 9 years ago

Yes, I also installed the font.

On Fri, Sep 4, 2015 at 12:43 AM Swaroop C H notifications@github.com wrote:

@laohyx https://github.com/laohyx I have Fira Mono installed and I do have Unicode symbols displayed, and Spacemacs is faster for me than the default Spacemacs font.

[image: screen shot 2015-09-03 at 11 43 09 pm] https://cloud.githubusercontent.com/assets/42988/9678021/8ecdf6ce-5295-11e5-8aad-892b0a45da7d.png

— Reply to this email directly or view it on GitHub https://github.com/syl20bnr/spacemacs/issues/1114#issuecomment-137659940 .

syl20bnr commented 9 years ago

Which format of the font have you installed ? Do you think we should switch the default font in Spacemacs ?

syl20bnr commented 9 years ago

@laohyx unicode symbols use fallback fonts so I'm suprised that changing the main font prevents the unicode characters from being displayed properly.

synic commented 9 years ago

I installed the ttf from the mozilla: https://github.com/mozilla/Fira/tree/master/ttf

I think it's worth looking into a font that is faster, but not Fira Mono :)

syl20bnr commented 9 years ago

@synic I agree. If you guys find a popular fastest font we can consider to change Source Code Pro. I wonder if the number of supported glyphs could slow Emacs.

xxv commented 9 years ago

Just to confirm, niling dotspacemacs-mode-line-unicode-symbols caused notable lag to go away on my configuration.

In particular, the lag was present when the whole screen would scroll (not just moving the cursor). And to be very specific about the lag, I mean: I would hold down j or k for 1s and release it: the cursor would keep moving (upwards of a couple seconds) and the scroll animation would be choppy while it moved. Now, if I release the key, it only continues scrolling for a fraction of the time it did previously.

This is Debian stretch/sid, running GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.4) of 2015-06-28 on trouble, modified by Debian. I'm running awesomewm and don't have Fira Mono. The fallback font is DejaVu Sans Book. I do have SourceCodePro and a couple Powerline fonts installed, though.

xxv commented 9 years ago

This bug report, Font-related window redrawing delays on OS X, may have some more interesting hints at a solution.

laohyx commented 9 years ago

@xxv , letting dotspacemacs-mode-line-unicode-symbols be t causes the notable lag.

I installed Fira Mono in ttf format, and the delay is notably decreased, but still a slightly lag comparing to no unicode symbols.

Indeed Fira Mono is much faster than Source Code pro on Mac OS X. But the unicode symbols still slows emacs. You can paste these symbols into a buffer, and you will see that moving cursor is very slow, even with Fira Mono.

ⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐ
ⓒⓒⓒⓒⓒⓒⓒⓒⓒⓒ
ⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻ

So that is a bug of emacs as @xxv said.

kendall commented 9 years ago

I can’t tell any perf diff on OSX between Fira Mono and Source Code Pro FYI. Cheers, Kendall

On Fri, Sep 4, 2015 at 11:51 AM, laohyx < notifications@github.com > wrote: @xxv , letting dotspacemacs-mode-line- unicode-symbols be t causes the notable lag.

I installed Fira Mono in ttf format, and the delay is notably decreased, but still a slightly lag comparing to no unicode symbols.

Indeed Fira Mono is much faster than Source Code pro on Mac OS X. But the unicode symbols still slows emacs. You can paste these symbols into a buffer, and you will see that moving cursor is very slow, even with Fira Mono .

ⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐⓐ ⓒⓒⓒⓒⓒⓒⓒⓒⓒⓒ ⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻⒻ

So that is a bug of emacs as @xxv said.

— Reply to this email directly or view it on GitHub .

d12frosted commented 9 years ago

Oh man. Setting dotspacemacs-mode-line-unicode-symbols to nil is like... well, riding rocket after using bicycle.

mbertheau commented 9 years ago

Just as a data point, dotspacemacs-mode-line-unicode-symbols makes no noticeable difference in speed on Ubuntu 14.04, and with the ⓐⓒⒻ characters in a buffer the point moves as fast as ever.

laohyx commented 9 years ago

Well, maybe the font issue is more complex than I thought. Many causes may make emacs slow.

On my computer, the unicode symbols slows emacs. After disabling dotspacemacs-mode-line-unicode-symbols, it works.

Then I upgrade my MAC OS X to El capitan GM edition, unicode symbols don't lag emacs any more. Maybe the El capitan Beta indeed have something wrong in unicode rendering.

My spacemacs runs soooooo fast, thank you all.

d12frosted commented 9 years ago

I'am experiencing problems even on 10.10.5 (14F27).

jetaggart commented 9 years ago

FWIW, @rphillips recommended install aspell which seemed to fix the issue with me. Mac OS X, development branch.

jetaggart commented 9 years ago

Nevermind, it's still slow :/ This is especially noticeable when editing ruby code.

d12frosted commented 9 years ago

I found that GNU Emacs 25.0.50.1 is much faster than emacs-mac. A lot of operations are much smoother in one very huge project I am using for testing purposes.

TheBB commented 8 years ago

Closing this now since this discussion has simmered down and it's really too general. You can open new issues for more specific performance problems if you find them.

Clamwinds commented 8 years ago

Changing the font from sans-mono to the fira-mono font fixed all my lag problems. It has something to do with that I guess. Thank the heavens.

Remember to restart spacemacs as well.

key words: spacemacs slow, performance, lag

kostajh commented 8 years ago

Just came across this myself. Fira Mono + disabling unicode made a massive difference. Should we perhaps mention this in the docstring in init.el so that it's easier to get this info in front of users?

stormpat commented 8 years ago

To reiterate on this, i have been using GNU Emacs 25 (head) on OSX, and the speed is much better than in the emacs-mac port. I suggest trying it out if someone has any perf problems with Spacemacs.

Also, i have the latest OSX version and im not sure if the font is still an issue. I have been using CamingoCode and M+ fonts they all work as they should. Not sure about Source Code Pro though.

kzjeef commented 8 years ago

Just my two cents,

I found If I change the powerline-scale to 1.0 (maybe means don't do any scale in dotspacemacs/init will improve a lot of scrolling speed.

seems the 1.1 scale is copy from default config.

like

   dotspacemacs-default-font '("Source Code Pro"
                               :size 13
                               :weight normal
                               :width normal
                               :powerline-scale 1.0)
sam217pa commented 8 years ago

I can also confirm that deactivating linum-mode for every programming mode : (add-hook 'prog-mode-hook (lambda () (spacemacs/toggle-line-numbers-off))) and / or deactivating smooth-scrolling increased speed a great deal. I did not change anything else.

epogue commented 8 years ago

@d12frosted Thank you for pointing out that GNU Emacs 25 is faster! Just switched from emacs-mac and it's night and day.

rdlugosz commented 8 years ago

FWIW, I've seen a similar issue in Vim when using unicode characters and different fonts. I believe the issue is related to whether or not a particular glyph is available in the currently-configured font. If it is, there's no speed impact. If it isn't, OS X does something to locate a fallback font and this process (or possibly the process of drawing the fallback) is slow. See my comment here for further details.

edit: a major clue with the issue I saw in vim was that the fontd process CPU usage would spike whenever vim (either in terminal or Macvim) was trying to display glyphs not found in the current font. In other words, I think this is more of an OS X issue than one specifically related to Spacemacs.

vladh commented 8 years ago

I can confirm that changing powerline-scale to 1.0 and switching to Emacs 25 led to a visible reduction of lag. It's still there, but not so bad. Strangely, switching to Fira Mono from Monaco didn't really do anything for me.

nwaywood commented 8 years ago

I have tried:

and I still have horrible lag on my MBP :( Even entering numbers into the calculator there is about a 1 second delay.

voeler commented 8 years ago

I had major input lag for pretty much anything in Spacemacs. After trying many things I simply started disbling minor modes until I found out flycheck caused the slowness on my Windows installation. Hope this helps anyone.

mrkgnao commented 8 years ago

I had an almost unusable spacemacs for a while after opening ~10 buffers, although it would be really snappy right after startup with only one or two buffers open. This was enough of a problem that I contemplated switching to, and even spent a few hours building a config for, neovim. It turns out killing linum-mode works the necessary magic and I don't have to go anywhere :)

Does anyone have any insight into why this happens?

daviswahl commented 7 years ago

The issue for me was with pbcopy. I believe it only occurs when you run emacs within a terminal, there's less of an issue when running from within the full application.

Simply toggling off pbcopy fixed my performance issues.

mrkgnao commented 7 years ago

Just to confirm, for me, it was linum-mode. Not using that has given me stable performance improvements, to the point where I don't have any palpable lag. This is based on using two setups (one Arch, one Gentoo, both on latest develop) for almost a month now.

djm commented 7 years ago

Just as another point, my lag has gone after disabling dotspacemacs-mode-line-unicode-symbols. The font in question was Operator Mono.

gitfoxi commented 7 years ago

I've been reading mail using the mu4e layer and I notice some messages are very slow to load.

Before reading this thread I didn't notice what the slow messages have is common: Chinese characters.

I wish there was a way to just turn off the unicode rendering since I don't speak Chinese I won't miss much. Of course it would be better if the rendering could be fast.