Fork me on GitHub
#spacemacs
<
2021-11-21
>
West02:11:12

Wanna see something weird? I just ran my profiler with a stripped down spacemacs config. Scrolling down takes a lot more cpu time than scrolling up. What could be the reason for this?

West02:11:25

Is there any way to profile at a lower level? Need some more detail as to what’s being called where.

West03:11:13

Turning off line numbers seemed to do the trick. That sucks though, because I really like having line numbers.

West03:11:47

Here’s the profiler after turning off line numbers.

West03:11:01

It’s still very strange to me that scrolling down still costs more cpu cycles than scrolling up though. I expect it should be equal.

West03:11:09

Now here’s what it looks like in gnu emacs with a pretty bare init file.

(setq scroll-step 1
      scroll-margin 1
      scroll-conservatively 100000)
I’m still baffled as to why scrolling up and down is asymmetric.

West03:11:35

I’m also baffled by just how slow adding line numbers is. Especially visual line numbers. That really makes me sad. I liked to have line numbers on so much, but I just can’t deal with the performance hit.

West04:11:21

I’m not sure. Let me try it.

West04:11:26

It’s still asymmetric even without advancing the screen.

West04:11:40

I just set my line-numbers-width to 3 and it’s still slow as hell. Using emacs 27.2, but this problem also exists on emacs-28 and higher as well.

ag22:11:46

There are tons of tiny things; separately, each may look rather insignificant. When they are pulled in all at once, it becomes a problem. See, for example: hl-line - it works fine in Linux, on a Mac it slows down things, just enough to see the difference. which-key sometimes adds almost 30% overhead - especially if used in posframe mode. CIDER adds more things that increase latency. if you use lsp-mode - that too. I recently switched to Doom (after several years of Spacemacs) because I felt tired hunting down every single hook, advice, and feature that doesn't add significant utilitarian value for me. Spacemacs does a lot. Doom has its own problems, and switching to it wasn't completely smooth and painless for me. I wouldn't recommend switching to Doom if you already invested in Spacemacs. If you want performance - hunt down every single thing you don't need. Try disabling minor modes. Remove hooks, de-advice functions.

ag22:11:50

> I liked to have line numbers on so much don't use linum-mode, use built-in (since v27) display-line-numbers-mode instead. linum is too slow

West23:11:39

I never use linum-mode, spacemacs uses display-line-numbers-mode by default, no?

practicalli-johnny13:11:03

@c.westrom Scrolling a buffer is not a very efficient with Emacs in general. Page up/down should be faster as is jumping to different locations in the buffer. There are many ways to configure smoother scrolling for Emacs - https://www.emacswiki.org/emacs/SmoothScrolling However, its still more efficient to learn how to navigate code rather than scrolling https://practical.li/spacemacs/navigating-code/