netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Fast editor scrolling "studders" with NetBeans 14 and 15

Open pleumann opened this issue 2 years ago • 2 comments

Apache NetBeans version

Apache NetBeans 14

What happened

The scroll performance of the main editor window got worse with NetBeans 14 and still is with NetBeans 15. It's not catastrophic, but noticeable, especially during fast scrolls (using scroll wheel or touch pad). It kind of "studders" several times when going through a large file, whereas is was totally smooth with NetBeans 13. Same machine, same JDK, same project and settings.

How to reproduce

Open a large file in the editor, scroll fast using a scroll wheel or touch pad gesture.

Did this work correctly in an earlier version?

Apache NetBeans 13

Operating System

M1 MacBook air with MacOS 12.4 (Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101)

JDK

openjdk version "17.0.4" 2022-07-19 LTS OpenJDK Runtime Environment Microsoft-38107 (build 17.0.4+8-LTS) OpenJDK 64-Bit Server VM Microsoft-38107 (build 17.0.4+8-LTS, mixed mode)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

pleumann avatar Sep 10 '22 13:09 pleumann

Can you please explain in more details, what happens exactly and in which file for example? I opened a large package-lock.json file (~3300 lines) and it feels good enough. We just need more information here to reproduce the issue. Working with NB 14 and NB 15, no problems.

Chris2011 avatar Sep 13 '22 20:09 Chris2011

It is possible this only happens for files that use syntax coloring. I did see it on larger Java files. It does not seem to happen on a 5K "arbitrary" text file (just checked). I will run some more experiments, maybe I can record my screen. I also would not say it's super bad, but it's noticeable. A bit as if the screen refreshing can't keep up with the scrolling at certain speeds (I tend do use the fast two-finger gesture on my touchpad where the fingers don't stay on the pad).

pleumann avatar Oct 04 '22 09:10 pleumann

Sorry for taking so long, but I finally found the time to reproduce it. I recorded a video. Maybe that helps.

https://youtu.be/9feEfOjbcls

I have the same project open in both versions of NetBeans. I am scrolling through the same (not too large) Java file using the "2 finger scroll gesture" on the touch pad. It is super-smooth in 13 and it studders in 15 (and 14, too). You should be able to see the "breaks" and "jumps" in the video. I use the gesture a lot for navigating through my files. The behavior is what kept me from switching to NetBeans 14, hoping 15 would fix it.

This is on a MacBook Air M1, Monterey, Microsoft Open JDK 17.

Let me know if you need more info.

pleumann avatar Oct 30 '22 17:10 pleumann

Unfortunately on Windows 11 with NB 15 and a 2k Java file, no problems. Everything is smooth. Maybe it is just a mac problem? Can you please share the project with us?

Chris2011 avatar Oct 30 '22 17:10 Chris2011

I'm happy to share the project, but I see the behavior for each and every project. I just used this one because it's a simple example. I can very well imagine it's Mac-specific, maybe either the Retina display or the M1 processor.

pleumann avatar Oct 30 '22 17:10 pleumann

Uploaded the project to github and sent an invite.

pleumann avatar Oct 30 '22 18:10 pleumann

More tests:

  1. The problem does not seem to happen on an older i7 Intel iMac I have (MacOS Mojave, same JDK as MacBook Air, but x64 version). NetBeans 14 and 15 are as smooth as 13 in this case. I connected the iMac's mouse to the MacBook to make sure it is the same scroll gesture that is being used, and this is indeed the case (i.e. scrolling via mouse has the same effect as scrolling via touch pad).

  2. The problem does not seem to happen for files that don't have syntax highlighting. For example, I have a Pascal file with 5K LOC and it's perfectly smooth.

pleumann avatar Oct 30 '22 19:10 pleumann

More tests: Same file. I keep "cursor down" pressed until I reach then end of the file.

Expected behavior: Cursor goes down to bottom visible line of editor, then file scrolls to the end with roughly constant speed.

Actual behavior: After the region with the comment it suddenly starts doing "delays" and "hops". Several times the cursor is transported back to the middle of the window. For a while it disappears completely.

https://youtu.be/8fBgzDxpG0w

Again, this does not happen with NetBeans 13 (just 14 and up), nor does it happen on the iMac with any version of NetBeans.

pleumann avatar Oct 30 '22 19:10 pleumann

And while I can't pinpoint it or capture it in a video, I would say the "ordinary editing" is slow and jumpy as well (i.e. sideways cursor movement or adding/deleting characters).

pleumann avatar Nov 03 '22 11:11 pleumann

Small, but probably interesting update: While I can still reproduce the issue with fresh installs of 14 and 15, it doesn't seem to occur with the newly released 16. Gesture scrolling is smooth again. The weird cursor jumps I tried to show in the video are gone. The overall "jerkiness" encountered when editing Java files (and probably other file with syntax support) is gone.

pleumann avatar Dec 14 '22 12:12 pleumann

iMac18,2 Quad-Core Intel Core i7 3,6 GHz 16 GB Catalina 10.15.7

java version "17.0.3.1" 2022-04-22 LTS

NetBeans 17, font 15pt Roboto Mono, LAG on JAVA class > 2000 ROW..

Increasing the font makes it worse.

diegofalcinelli avatar Mar 03 '23 11:03 diegofalcinelli

Is there any improvement when switching from JDK 17 to 20?

JDK got a new rendering backend for MacOS https://openjdk.org/jeps/382, which is enabled by default since JDK 19 JDK-8284378.

(-Dsun.java2d.metal=true to enable it before JDK 19)

mbien avatar Aug 10 '23 01:08 mbien

I tried with Mac Os Ventura / NB19 / MacBook Pro M1 on a java file > 2000 Lines and can't see any jumping or "stuttering". Tried different font sizes which makes no difference for me.

sroeper avatar Sep 27 '23 12:09 sroeper