Bug 550396 - UI freeze of 15s on enabling word wrap in file with marker
Summary: UI freeze of 15s on enabling word wrap in file with marker
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Thomas Wolf CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 550209
  Show dependency tree
 
Reported: 2019-08-23 18:19 EDT by Thomas Wolf CLA
Modified: 2019-09-10 14:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wolf CLA 2019-08-23 18:19:28 EDT
Steps to reproduce:

1. Create a file of 40000 lines, all rather short:

  $ for i in $(seq 40000); do echo "Line $i" >> longFile.txt; done

2. Get that file into the Eclipse workspace
3. Open it
4. Create a bookmark on line 1
5. Press the "Toggle Word Wrap" button to switch on word wrap

Expected: no UI freeze at all (editor window was more than wide enough, no line needed to wrap)

Actual: 15s UI freeze

!ENTRY org.eclipse.ui.monitoring 4 0 2019-08-24 00:09:43.401
!MESSAGE UI freeze of 15s at 00:09:27.998
!SUBENTRY 1 org.eclipse.ui.monitoring 1 0 2019-08-24 00:09:43.401
!MESSAGE Sample at 00:09:33.489 (+5,491s)
Thread 'main' tid=1 (RUNNABLE)
!STACK 0
Stack Trace
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSObject.release(NSObject.java:163)
	at org.eclipse.swt.graphics.TextLayout.destroy(TextLayout.java:367)
	at org.eclipse.swt.graphics.Resource.dispose(Resource.java:69)
	at org.eclipse.swt.custom.StyledTextRenderer.disposeTextLayout(StyledTextRenderer.java:417)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:299)
	at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:664)
	at org.eclipse.swt.custom.StyledText.getLinePixel(StyledText.java:4262)
	at org.eclipse.jface.text.JFaceTextUtil.getLinePixel(JFaceTextUtil.java:288)
	at org.eclipse.jface.text.JFaceTextUtil.computeLineHeight(JFaceTextUtil.java:82)
	at org.eclipse.jface.text.source.OverviewRuler$WidgetInfos.<init>(OverviewRuler.java:346)
	at org.eclipse.jface.text.source.OverviewRuler.doPaint(OverviewRuler.java:764)
	at org.eclipse.jface.text.source.OverviewRuler.doubleBufferPaint(OverviewRuler.java:682)
	at org.eclipse.jface.text.source.OverviewRuler.lambda$1(OverviewRuler.java:585)
	at org.eclipse.jface.text.source.OverviewRuler$$Lambda$509/0x0000000100ad8c40.paintControl(Unknown Source)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4364)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1278)
	at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:176)
	at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:776)
	at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5996)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5242)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5674)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:97)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3762)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
	at org.eclipse.ui.internal.Workbench$$Lambda$166/0x0000000100427440.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base@11.0.3/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@11.0.3/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base@11.0.3/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@11.0.3/java.lang.reflect.Method.invoke(Method.java:566)
	at app//org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
	at app//org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at app//org.eclipse.equinox.launcher.Main.run(Main.java:1468)
Comment 1 Thomas Wolf CLA 2019-08-23 18:23:16 EDT
Problem is not the word wrap but the OverviewRuler, which goes calculate all line heights even though it only needs those of the visible lines. (Word wrap sets the StyledText to variable line height, and then StyledText cannot simply multiply a fixed known line height by the number of lines.)
Comment 2 Eclipse Genie CLA 2019-08-23 18:39:54 EDT
New Gerrit change created: https://git.eclipse.org/r/148258
Comment 4 Paul Pazderski CLA 2019-09-10 14:05:05 EDT
Merged. Thanks Thomas!