apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.62k stars 840 forks source link

MacOS very slow jerky scrolling with recent versions #7568

Open sjdrew opened 1 month ago

sjdrew commented 1 month ago

Apache NetBeans version

Apache NetBeans 22

What happened

Previously a few in our team, like myself were running netbeans 12 for many years on macos. Recently we upgraded to netbeans 22. Now netbeans is very painful to use, the scrolling is very slow, stalls often. This is viewing mostly php files.

One team member is on version 20 and same problem.

Language / Project Type / NetBeans Component

PHP Project

How to reproduce

Seems like any php file I open that is more than 1,000 lines or so has this problem.

Macs are M1 with 32 GB of memory.

Did this work correctly in an earlier version?

Apache NetBeans 16 or earlier

Operating System

MacOS Sanoma 14.5

JDK

OpenJDK Runtime Environment Homebrew (build 17.0.7+0)

Apache NetBeans packaging

Other

Anything else

Installed via https://github.com/codelerity/netbeans-installers/releases/download/v22-build1/Apache-NetBeans-22-aarch64.pkg (Azul Zulu build of OpenJDK)

Are you willing to submit a pull request?

No

matthiasblaesing commented 1 month ago

You could try to activate self-profile mode, scroll a bit, stop it and see if something pops up:

image

You can save the resulting profile and attach here.

You can also try a different JDK. For JDK17 Version 17.0.11 is current, in general current LTS Version is JDK21.

sjdrew commented 1 month ago

profile_snapshot.nps.zip

ok I attached a profile capture while scrolling.

matthiasblaesing commented 1 month ago

This looks suspicious:

image

it looks as if the application is spending considerable time in the Metal Implentation of the Java2D renderer. You can try to fallback to OpenGL Rendering (see last paragraph of issue description):

https://bugs.openjdk.org/browse/JDK-8284381

When launching NetBeans pass -J-Dsun.java2d.metal=false or -J-Dsun.java2d.opengl=true to the launcher. (the -J prefix instructs it to pass the arguments to the underlying java launcher).

But I repeat: Your JDK is not current, so this might already be fixed.

sjdrew commented 1 month ago

Sorry, but how do I go about adding that parameter to the launcher under macos, cannot find any docs on that?

matthiasblaesing commented 1 month ago

Sorry, not a mac user, so can't help.

sjdrew commented 1 month ago

Thanks I updated the .conf file with that and wow what a difference, so much faster and smooth. Thanks for the tip.

Hopefully that gets fixed for next version.

neilcsmith-net commented 1 month ago

There's no way to add parameters with the macOS launcher, and changing the conf file inside the installation is problematic because it'll mark the bundle as broken.

The best cross-platform approach to this is to copy etc/netbeans.conf to the userdir - eg. <userdir>/etc/netbeans.conf and edit it there.

If you're using the Codelerity installers then the JDK in the report is wrong - this will be the current Azul JDK 22. I can potentially look at adapting the build for the NB23 versions of those to add that flag in for macOS only. We can't add that for all builds here as it will affect other OS. We've had discussion before about splitting the options so that module requirements are separate, and it might be we need to look at supporting OS specific options too? Other than that we're waiting on the issue being fixed in the JDK.

matthiasblaesing commented 1 month ago

I don't think adding a switch will help or at least only as a partial fix. If I read the referenced JDK issue correctly, the OpenGL pipeline for mac OS might be removed. This needs to be reported upstream in the JDK as an issue and fixed in the JDK. Either blitting in metal is really that expensive or it is called too often.

In anycase I won't be that one. This needs somebody who can reproduce the problem and I don't own a mac and have no plans to change that.