set-window-margins: lag moving cursor?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

set-window-margins: lag moving cursor?

Marcelo Toledo
Hi,

I've recently noticed a lag moving cursor around. When trying to track down the problem I’ve noticed that it was related to set-window-margins.

Why am I using set-window-margins?

When I use really large monitors with GNU Emacs and only one window, I like to add margins left and right to align 100 columns of total width in the middle. Code gets centralized and it’s easier to code.

Code I am using currently: https://github.com/marcelotoledo/centralized-mode
Code I was using before: https://github.com/rnkn/olivetti

What environment I’ve tested:

* Mac OS X 10.14
* GNU Emacs 26.1 (latest stable version)
* Build options: ./configure --build=x86_64-apple-darwin --without-dbus --with-ns

In that environment I’ve tested speed of cursor moving around random files.

How exactly I’ve tested?

I’ve set the cursor in the top of the buffer and measured the speed to reach the buttom simply pressing the key binded to <down>. I’ve done that several times and calculated the average (it was pretty steady).

When I don’t have set-window-margins set it’s moving in a regular speed.

But whenever have set-window-margins set, it’s easy to notice a ~ 25% reduction of speed moving cursor around.

I’ve been reading the source code and trying to figure out what exactly is the problem and I was wondering if anyone could help me understand why this is happening and what part of code is bringing this behavior.

Happy to provide more data.

Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: set-window-margins: lag moving cursor?

Eli Zaretskii
> From: Marcelo Toledo <[hidden email]>
> Date: Wed, 6 Feb 2019 18:09:15 -0200
>
> When I use really large monitors with GNU Emacs and only one window, I like to add margins left and right to align 100 columns of total width in the middle. Code gets centralized and it’s easier to code.
>
> Code I am using currently: https://github.com/marcelotoledo/centralized-mode
> Code I was using before: https://github.com/rnkn/olivetti
>
> What environment I’ve tested:
>
> * Mac OS X 10.14
> * GNU Emacs 26.1 (latest stable version)
> * Build options: ./configure --build=x86_64-apple-darwin --without-dbus --with-ns
>
> In that environment I’ve tested speed of cursor moving around random files.
>
> How exactly I’ve tested?
>
> I’ve set the cursor in the top of the buffer and measured the speed to reach the buttom simply pressing the key binded to <down>. I’ve done that several times and calculated the average (it was pretty steady).
>
> When I don’t have set-window-margins set it’s moving in a regular speed.
>
> But whenever have set-window-margins set, it’s easy to notice a ~ 25% reduction of speed moving cursor around.
>
> I’ve been reading the source code and trying to figure out what exactly is the problem and I was wondering if anyone could help me understand why this is happening and what part of code is bringing this behavior.
>
> Happy to provide more data.

Thanks.  Please show a complete recipe to reproduce this problem,
starting from "emacs -Q", including how you measured the speed.  A 25%
slowdown is not easy to spot, so I want to be sure I'm doing the same
as you did to see the problem, and measure the same quantity.  Up
front, I don't see why cursor motion would be significantly slower
with margins, but maybe I'm missing something.

Reply | Threaded
Open this post in threaded view
|

Re: set-window-margins: lag moving cursor?

Eli Zaretskii
> From: Marcelo Toledo <[hidden email]>
> Date: Fri, 8 Feb 2019 18:49:58 -0200
>
> > On 8 Feb 2019, at 11:26, Marcelo Toledo <[hidden email]> wrote:
> >
> >
> >> Thanks.  Please show a complete recipe to reproduce this problem,
> >> starting from "emacs -Q", including how you measured the speed.  A 25%
> >> slowdown is not easy to spot, so I want to be sure I'm doing the same
> >> as you did to see the problem, and measure the same quantity.  Up
> >> front, I don't see why cursor motion would be significantly slower
> >> with margins, but maybe I'm missing something.
> >
> > Thanks for replying. I’ve touched so many parts in the build that the problem is solved and I don’t know what solved it. If I figure it out I’ll make sure to reply to the list. Tks again.
>
> Just got home and the symptom was back. The problem was the monitor refresh rate, I was using a scaled resolution and it was extremely affecting performance. Just moved to a native resolution 4k and everything was back to normal.
>
> Sorry for the confusion/trouble.

OK, thanks for following up.