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

Improving Performance #1114

Closed
fasddag opened this issue Apr 11, 2015 · 82 comments
Closed

Improving Performance #1114

fasddag opened this issue Apr 11, 2015 · 82 comments

Comments

@fasddag
Copy link

fasddag commented Apr 11, 2015

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?

@trishume
Copy link
Contributor

Spacemacs shouldn't be slow other than maybe startup. If it is slow it is usually one specific laggy thing and not general cruft.

What kind of slowness are you experiencing? When is it happening?

@syl20bnr
Copy link
Owner

If you are on develop, auto-completion is not part of the stock spacemacs, you have to add the layer explicitly in your dotfile.
For the packages you don't want you can add them to dotspacemacs-excluded-packages list and spacemacs will ignore them and then uninstall them.

@CarlQLange
Copy link
Contributor

Also, just to answer your specific question, linum is a package that displays the line numbers of the file you're in :)

@tuhdo
Copy link
Contributor

tuhdo commented Apr 12, 2015

I wonder what your performance problem is. Could you be more specific?

@fasddag
Copy link
Author

fasddag commented Apr 12, 2015

I have a general lag after pretty much any input. Which is particularly noticeable after simple commands, like "j", "k" in normal mode and typing, backspace and ctrl+w in insert mode.
This is because you expect them to be instant, but they aren't.
Also, this delay builds up.
So, for example, if I go ctrl+w, ctrl+w... five times it will pause shortly, delete last word, then pause for longer and delete the other four. If I push and hold "j", it will scroll some, then pause and scroll in chunks or not scroll at all if I am in a larger org-mode-file until I release the "j".

("j", "k" performance can be improved by turning off visual-line-mode, the clever word wrap thing. It also much faster when the cursor does not have to move horizontally, for example when scrolling through commented text and cursor stays on the first character in a line. But fast "j", "k" is not essential with all the other movement options.)

@syl20bnr
Copy link
Owner

You can disable the mode listed in the mode line with circled letter by pressing on SPC t <letter> where letter corresponds to the circled letter. If you disable auto-completion with SPC t a is it better ?

@fasddag
Copy link
Author

fasddag commented Apr 15, 2015

"spc t a" did not make a noticeable difference.
Seeing how spacemacs-lite is, apparently, not a thing, am I to close this issue?

ps thanks for your help and spacemacs syl20bnr.

@jb55
Copy link
Contributor

jb55 commented Apr 17, 2015

This is actually a big deal for me as well. I get considerable hjkl lag. Any way to profile this? I have all modeline modes disabled.

@trishume
Copy link
Contributor

System specs might help. OS? Emacs version? Where did you get your emacs? Is your computer old?

Also scope statements and testing might help. Does this happen in multiple types of buffer, or just a certain language? What layers do you have installed?

@jb55
Copy link
Contributor

jb55 commented Apr 17, 2015

  • Macbook Pro retina mid 2012
  • 2.3 GHz Intel Core i7
  • SSD
  • Yosemite
  • Emacs 24.4.1 (gui mode)

Happens in all buffers, even in fundamental mode. It gets worse over time. When I restart emacs it gets a bit snappier but only for a short while. Killing all buffers doesn't seem to help.

I'm guessing some list is being accumulated and traversed over time and is called on every motion? That's my best guess...

@tuhdo
Copy link
Contributor

tuhdo commented Apr 17, 2015

Is the Emacs you are using from Emacs Mac OS X? If so, you should upgrade to Emacs 24.5 since the "stable" version is not so stable. See this issue: #1184

@jb55
Copy link
Contributor

jb55 commented Apr 17, 2015

I'm using the version recommended in the docs: https://github.com/syl20bnr/spacemacs#os-x

@x-ji
Copy link
Contributor

x-ji commented Jun 6, 2015

I wonder whether this has something to do with this issue #1369 The performance issue I experienced was related to a savehist variable kill-ring and now it has been removed in develop branch. Maybe you can give it a try?

@jasonkuhrt
Copy link
Contributor

I found this issue because I was coming to open a discussion about performance too. General text entry in spacemacs is noticeably and quite much slower than e.g. SublimeText. Smooth scrolling is way worse, but I would be happy to just get decently performing text entry at least. Text entry in vim is also very fast on my machine, its just emacs that is quite slow seemingly. I know the next thing to do is display a bunch of stats about my machine and plugins I am using, but I can frankly say that I have done very little to tax what is basically a default spacemacs install on a solid machine (same as @jb55 basically). In other words, it doesn't seem to be easy to just fall into the pit of performance by default. Users need to "think" about it?

More generally my concern is whether emacs is just generally never going to match vim et al in editing performance. I couldn't care less about startup time for now.

@rphillips
Copy link

Make sure your Key Repeat and Delay Until Repeat are customized to your liking within the "System Preferences" -> "Keyboard" preferences. Delay Until Repeat should probably be short. There still might be something wrong with Emacs, but this global improvement should be double checked.

@tuhdo
Copy link
Contributor

tuhdo commented Jun 11, 2015

How slow is slow? I opened a 300MB text file fine in fundamental-mode. For programming modes, even files with 10-20k lines are non-issue.

@jasonkuhrt
Copy link
Contributor

@tuhdo These are hard discussions to have accurately. For a quick and dirty test can you open that same file in SublimeText and tell me if you can observe an improvement? Large one?

@tuhdo
Copy link
Contributor

tuhdo commented Jun 11, 2015

If you want to open large file, be sure to disable smooth scrolling. It improves performance quite significant.

@jasonkuhrt
Copy link
Contributor

@rphillips I updated that setting though not related to the performance I am talking about. hjkl navigation and so on is simply not on par with raw vim.

@jasonkuhrt
Copy link
Contributor

disable smooth scrolling

How?

@x-ji
Copy link
Contributor

x-ji commented Jun 11, 2015

I'd say text entry is indeed considerably slower than in Vim especially in modes such as orgmode, though it occurs in all major modes. But the cursor movement speed was quite OK and not that far away from Vim when I set both Key Repeat and Delay Until Repeat to their respective maximum values. Not sure if there's some configuration issue.

@tuhdo
Copy link
Contributor

tuhdo commented Jun 11, 2015

I have no problem with Emacs. It scrolls fast, even with that 300MB text file. If you want a prorgramming file to test, SPC h L then open vhdl-mode.el.gz. It's 17k elisp lines and I can press C-v repeatedly to continuously scroll.

My OS is Ubuntu on a 5400 rpm hard drive with a 5 years-old Windows.

How?

Set dotspacemacs-smooth-scrolling to nil in your .spacemacs.

@rphillips
Copy link

I did see something like this awhile ago, and IIRC installing aspell from homebrew cleared it up for me.

@syl20bnr
Copy link
Owner

@jasonkuhrt What theme are you using ? On XQuartz on Yosemite I have poor performance with some themes like zenburn and some others, the display is slower in every way with these themes, I don't know why.

Also what build and version of Emacs are your using ? I was impressed by emacs-mac-port from homebrew which is far more responsive than the stock brew Emacs build under XQuartz.

@syl20bnr
Copy link
Owner

@jasonkuhrt also do you have any similar performance issue with emacs -nw ?

@x-ji
Copy link
Contributor

x-ji commented Jun 11, 2015

@syl20bnr indeed emacs-mac-port seems to perform much better. Text entry speed is quite OK now. Maybe worth mentioning this in the README file or documentation? Otherwise sometimes people like me might get confused and thought the performance issue stems from Spacemacs while it seems that the real problem lies with the Emacs build we chose. Currently there's no listed reason why emacs-mac-port is recommended over others in README.

@trishume
Copy link
Contributor

@x-ji good point about giving a reason. The real reason though is not just performance, it is better in every conceivable way. Better rendering, better perf, better OSX integration, better scrolling, better stability, ...

@jasonkuhrt
Copy link
Contributor

@syl20bnr emacs-mac?

❯ brew search emacs
emacs                         emacs-mac
emacs-clang-complete-async            railwaycat/emacsmacport/emacs-mac
Caskroom/cask/emacs

@syl20bnr
Copy link
Owner

@jasonkuhrt Indeed emacs-mac sorry, it has support for spacemacs icon, be sure to check the available options :-) (there is a PR running to add this to the README).

@d12frosted
Copy link
Contributor

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

@jetaggart
Copy link

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

@jetaggart
Copy link

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

@d12frosted
Copy link
Contributor

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
Copy link
Contributor

TheBB commented Oct 28, 2015

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
Copy link

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
Copy link
Contributor

kostajh commented Mar 20, 2016

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
Copy link
Contributor

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
Copy link

kzjeef commented Apr 20, 2016

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
Copy link

sam217pa commented Apr 27, 2016

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
Copy link

epogue commented Apr 28, 2016

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

@rdlugosz
Copy link

rdlugosz commented May 16, 2016

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
Copy link

vladh commented May 28, 2016

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
Copy link

nwaywood commented Jun 6, 2016

I have tried:

  • Fira Mono font
  • :powerline-scale 1.0
  • GNU Emacs 25
  • dotspacemacs-mode-line-unicode-symbols to nil

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

d12frosted pushed a commit to d12frosted/environment that referenced this issue Jun 16, 2016
d12frosted pushed a commit to d12frosted/environment that referenced this issue Jun 16, 2016
d12frosted pushed a commit to d12frosted/environment that referenced this issue Jun 16, 2016
d12frosted pushed a commit to d12frosted/environment that referenced this issue Jun 16, 2016
d12frosted pushed a commit to d12frosted/environment that referenced this issue Jun 17, 2016
@voeler
Copy link

voeler commented Aug 5, 2016

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
Copy link

mrkgnao commented Oct 13, 2016

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
Copy link

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
Copy link

mrkgnao commented Nov 12, 2016

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
Copy link
Contributor

djm commented Dec 9, 2016

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

@gitfoxi
Copy link

gitfoxi commented Mar 14, 2017

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.

bradrn added a commit to bradrn/.spacemacs.d that referenced this issue Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests