apache / apache/netbeans

Massive performance drop in editor on large files, cause of code folding

Open
#8,677 1 comment 0 reactions 0 assignees View on GitHub
Editor kind:bug needs:triage performance
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 26

### What happened

Currently I cannot provide the code that cause this but it looks like it is a scaling issue of a situation in "code folding". Disabling code folding brings performance to normal. It has been observed on large files > 20k lines of various java code of any kind and comments.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

Maybe by scaling a large file >20k lines of various code and enable code folding. If I can isolate the cause, I will provide the findings.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 10 pro

### JDK

24

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

The IDE log looks like this:

```
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x334e67b8, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x246923b, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x3aa2f9d6, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x246923b, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x37a3e157, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x246923b, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x5ef29c80, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x246923b, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x2f6f8080, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@56e02d1

... 5K entries

New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x3f7377d, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x3978da70, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1bd6f6d0, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x2577fe71, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x4a4c024a, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x568b02c8, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x7ad396d1, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x4f293429, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x4be78567, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed.
Existing fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1c367488, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
New fold: [code-block] E2 <354169,358341>, desc='{...}', hash=0x1fcf680f, [354169, 358341] {354170, 358340}; FoldManager: org.netbeans.modules.java.editor.fold.JavaElementFoldManager@61e22438
```

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a Java file larger than 20,000 lines on NetBeans 26, comparing editor performance with code folding enabled and disabled. Inspect the IDE log around JavaElementFoldManager and the repeated identical-fold messages. Done means the large file no longer causes a major performance drop and the repeated duplicate-fold entries are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.