Bug 407405 - CDT Build Console very slow with line wrapping on
Summary: CDT Build Console very slow with line wrapping on
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 8.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 9.6.0   Edit
Assignee: Jonah Graham CLA
QA Contact: Andrew Gvozdev CLA
URL:
Whiteboard:
Keywords:
: 535172 535326 537323 (view as bug list)
Depends on: 168557 199605
Blocks:
  Show dependency tree
 
Reported: 2013-05-07 09:15 EDT by Walter Brunauer CLA
Modified: 2018-11-18 07:05 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Brunauer CLA 2013-05-07 09:15:11 EDT
Create any two projects and build them. Make sure at least one is producing large build output (1000s of lines). This could be faked by just doing a cat of a big file. Then switch the selection between the project in the Project Explorer.

The whole UI will block for ~ 1 second per 1000 lines of build output, every time you switch selection between projects to the project with large build output.

Backtrace:

Thread [main] (Suspended (breakpoint at line 4191 in StyledText))   
    StyledText.getLinePixel(int) line: 4191   
    StyledText.getPointAtOffset(int) line: 5439   
    StyledText.setCaretLocation() line: 8392   
    StyledText.setCaretOffset(int) line: 8481   
    BuildConsoleViewer.revealEndOfDocument() line: 120   
    BuildConsoleViewer.setDocument(IDocument) line: 150   
    BuildConsolePage.setDocument() line: 169   
    BuildConsolePage.selectionChanged(IWorkbenchPart, ISelection) line: 448   
    PageSelectionService(AbstractSelectionService).fireSelection(IWorkbenchPart, ISelection) line: 156   
    AbstractSelectionService$1.selectionChanged(SelectionChangedEvent) line: 62   
    Viewer$2.run() line: 164   
    SafeRunner.run(ISafeRunnable) line: 42   
    JFaceUtil$1.run(ISafeRunnable) line: 49   
    SafeRunnable.run(ISafeRunnable) line: 175   
    CommonViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 162   
    CommonViewer(StructuredViewer).updateSelection(ISelection) line: 2188   
    CommonViewer(StructuredViewer).handleSelect(SelectionEvent) line: 1211   
    CommonViewer.handleSelect(SelectionEvent) line: 478   
    StructuredViewer$4.widgetSelected(SelectionEvent) line: 1241   
    OpenStrategy.fireSelectionEvent(SelectionEvent) line: 239   
    OpenStrategy.access$4(OpenStrategy, SelectionEvent) line: 233   
    OpenStrategy$1.handleEvent(Event) line: 403   
    EventTable.sendEvent(Event) line: 84   
    Tree(Widget).sendEvent(Event) line: 1053   
    Display.runDeferredEvents() line: 4169   
    Display.readAndDispatch() line: 3758   
    Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2701   
    Workbench.runUI() line: 2665   
    Workbench.access$4(Workbench) line: 2499   
    Workbench$7.run() line: 679   
    Realm.runWithDefault(Realm, Runnable) line: 332   
    Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 668   
    PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149   
    IDEApplication.start(IApplicationContext) line: 124   
    EclipseAppHandle.run(Object) line: 196   
    EclipseAppLauncher.runApplication(Object) line: 110   
    EclipseAppLauncher.start(Object) line: 79   
    EclipseStarter.run(Object) line: 353   
    EclipseStarter.run(String[], Runnable) line: 180   
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]   
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39   
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25   
    Method.invoke(Object, Object...) line: 597   
    Main.invokeFramework(String[], URL[]) line: 629   
    Main.basicRun(String[]) line: 584   
    Main.run(String[]) line: 1438   
    Main.main(String[]) line: 1414   

This is caused solely because the CDT build console does not use fixed line height (particularly, because it wraps lines).

Fix: remove the line "styledText.setWordWrap(true);" from org.eclipse.cdt.internal.ui.buildconsole.BuildConsoleViewer.BuildConsoleViewer(Composite).
Comment 1 Andrew Gvozdev CLA 2013-05-07 09:59:27 EDT
This helps tremendously in my environment. Do you care to submit a patch here or in Gerrit?

Still, my take is that this will require an additional preference for wrapping mode. Some of these lines in build output are unmanageable long. I would keep wrapping preference false by default because of the performance issue.
Comment 2 Andrew Gvozdev CLA 2013-05-15 14:52:08 EDT
I added the preference and wrapping button to the console toolbar in bug 199605. Unfortunately a simple fix like suggested in the description won't work anymore. More analysis is needed.
Comment 3 Andrew Gvozdev CLA 2013-05-16 11:18:17 EDT
I observe 2 causes of slowness. One is reported in this bug and related to wrapping. It relates to problem with StyledText reported in bug 168557. Another one is related to bug 314428 and happens when there are many problem markers associated with the console.

As it stands after the changes in bug 199605 - one can disable wrapping in build console preferences and restart eclipse. That will avoid slowness related to wrapping and analogous to the fix suggested in the description. I am considering having wrapping off by default. There is a catch - it works as long as wrapping is not enabled. If a user enables it once disabling it back does not revert to the faster console. It is because StyledText.fixedLineHeight gets permanently set to false and that is not reversible.
Comment 4 CDT Genie CLA 2013-05-17 09:23:04 EDT
*** cdt git genie on behalf of Andrew Gvozdev ***

    bug 407405 CDT Build Console blocks UI on every Project Explorer selection - set wrapping off by default to mitigate the issue.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a1f4c57eade00bbd23b6319c7af97374f51b74db
Comment 5 Jonah Graham CLA 2018-06-04 16:34:56 EDT
*** Bug 535326 has been marked as a duplicate of this bug. ***
Comment 6 Jonah Graham CLA 2018-06-04 17:31:54 EDT
Frustratingly the toolbar item (https://bugs.eclipse.org/bugs/attachment.cgi?id=274322) for line wrapping is not persistent. To turn it off you must go to Window -> Preferences -> C/C++ -> Build -> Console and uncheck "Wrap lines in the console". Once off (due to Comment 3), restart Eclipse to get best peformance.
Comment 7 Jonah Graham CLA 2018-06-21 02:52:28 EDT
*** Bug 535172 has been marked as a duplicate of this bug. ***
Comment 8 Jonah Graham CLA 2018-07-04 04:34:06 EDT
9.5.1 is for some critical changes after Photon release. This item needs to wait until "normal" severity release.
Comment 9 Jonah Graham CLA 2018-07-23 15:34:21 EDT
9.5.2 is for some critical changes after Photon release. This item needs to wait until "normal" severity release.
Comment 10 Jonah Graham CLA 2018-07-24 05:26:17 EDT
*** Bug 537323 has been marked as a duplicate of this bug. ***
Comment 11 Jonah Graham CLA 2018-09-19 17:38:05 EDT
I was unrealistic targeting 9.5.3, it is still very much a priority for this year, apologies for the delay.
Comment 12 Alessandro Fardin CLA 2018-11-13 16:34:32 EST
any news about this one ?
Comment 13 Jonah Graham CLA 2018-11-13 16:45:36 EST
(In reply to Alessandro Fardin from comment #12)
> any news about this one ?

Coming in 9.6 - due Dec 2018. 

Note that the change will not make line wrapping work faster, but simply make it harder to have line wrapping on when it makes UI slow.
Comment 14 Eclipse Genie CLA 2018-11-17 14:56:50 EST
New Gerrit change created: https://git.eclipse.org/r/132617
Comment 16 Jonah Graham CLA 2018-11-18 07:05:50 EST
Done. An entry has been added to N&N https://wiki.eclipse.org/CDT/User/NewIn96#Build