Bug 559542 - Performance regression in toggle comment command
Summary: Performance regression in toggle comment command
Status: CLOSED DUPLICATE of bug 559230
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.15   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.15 M3   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2020-01-25 15:34 EST by Stephan Herrmann CLA
Modified: 2020-01-25 18:00 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2020-01-25 15:34:48 EST
Build id: I20200113-1800

Invoking Toggle Comment in a Java file of significant size (e.g., NullTypeAnnotationTest from JDT/Core - 17KLoc), freezes the UI for several seconds, even when commenting only a single line (at the top of the file).

Interestingly, the UI responsiveness monitor does not detect the freeze even with a threshold that is definitely passed.

Using jstack a typical stack has this:

"main" #1 prio=6 os_prio=0 cpu=68410,77ms elapsed=604,21s tid=0x00007f4fb0019800 nid=0x59cb runnable  [0x00007f4fb7489000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1256)
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:893)
        at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:301)
        at org.eclipse.swt.custom.StyledTextRenderer.getWidth(StyledTextRenderer.java:1310)
        at org.eclipse.swt.custom.StyledText.setScrollBars(StyledText.java:9855)
        at org.eclipse.swt.custom.StyledText.resetCache(StyledText.java:8093)
        at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:10289)
        at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:8006)
        at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4693)
        at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4770)
        at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:562)
        at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:551)
        at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:547)
        at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:215)
        at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2709)
        at org.eclipse.jface.text.TextViewer.fireRedrawChanged(TextViewer.java:4915)
        at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4955)
        at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4923)
        at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:5005)
        at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4979)
        at org.eclipse.jface.text.TextViewer$RewriteTarget.setRedraw(TextViewer.java:1000)
        at org.eclipse.jface.text.TextViewer$DocumentRewriteSessionListener.documentRewriteSessionChanged(TextViewer.java:1392)
        at org.eclipse.jface.text.AbstractDocument.fireRewriteSessionChanged(AbstractDocument.java:1440)
        at org.eclipse.jface.text.AbstractDocument.stopRewriteSession(AbstractDocument.java:1521)
        at org.eclipse.core.internal.filebuffers.SynchronizableDocument.stopRewriteSession(SynchronizableDocument.java:108)
        - locked <0x000000008a263bb8> (a java.lang.Object)
        at org.eclipse.jface.text.TextViewer.shift(TextViewer.java:4275)
        at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3889)
        at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:1064)
        at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1466)
        at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:199)
        at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:206)
        at org.eclipse.jdt.internal.ui.javaeditor.ToggleCommentAction$1.run(ToggleCommentAction.java:111)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
        at org.eclipse.jdt.internal.ui.javaeditor.ToggleCommentAction.run(ToggleCommentAction.java:108)


Seeing so much work in JFace/Text I suspected code minings, but those are turned of in this workspace.
Comment 1 Andrey Loskutov CLA 2020-01-25 15:38:08 EST
Stephan, it was a regression in StyledText, that was reverted - please try latest build.
Comment 2 Stephan Herrmann CLA 2020-01-25 18:00:07 EST
(In reply to Andrey Loskutov from comment #1)
> Stephan, it was a regression in StyledText, that was reverted - please try
> latest build.

Thanks, yes not a problem in I20200124-1800

*** This bug has been marked as a duplicate of bug 559230 ***