Skip to content

[Bug] After updating to 0.18.0 Agents are extremely slow #259

Closed

Description

@maxentric-aplymoth

After the latest updates, Agents are extremely slow, thinking for extremely long time, even the moderate ones. Tasks that used to take 10-15 minutes, now takes several hours. Mostly tested with GPT 5.4-medium.

Activity

  1. added
    bug
    on May 26, 2026
  2. iloveeclipse commented on May 26, 2026

    @iloveeclipse
    Contributor

    Could be GPT only issue. I tried today Claude Opus 4.7 and GPT 5.5 for same task (code review), later was really slow. It printed sentences in the "thinking" mode word by word, as it would really think :)

  3. jdneo commented on May 27, 2026

    @jdneo
    Member

    I did not notice this with GPT 5.4-medium, is the behavior still the same now?

    Or, do you observe the pattern that: chat view rendered smoothly at the beginning, and when more and more elements added, it becomes slow?

  4. ethanyhou commented on May 27, 2026

    @ethanyhou
    Contributor

    Hi maxentric-aplymoth, and Andrey Loskutov (@iloveeclipse),

    Thanks for the feedback. We’re looking into this issue. Please stay tuned.

  5. ethanyhou commented on May 29, 2026

    @ethanyhou
    Contributor

    Hi Andrey Loskutov (@iloveeclipse),

    I'm currently investigating this issue and have tried several fixes to reduce the overhead of rendering the thinking block, but none of them have been effective. One thing I noticed is that the thinking block always becomes slow or gets stuck after the following error occurs:

    !ENTRY org.eclipse.ui.console 4 120 2026-05-29 22:20:05.286
    !MESSAGE fixed width: false
    !STACK 0
    org.eclipse.jface.text.BadLocationException: 244
    	at org.eclipse.jface.text.TreeLineTracker.offsetByLine(TreeLineTracker.java:335)
    	at org.eclipse.jface.text.TreeLineTracker.getLineOffset(TreeLineTracker.java:1101)
    	at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:252)
    	at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:868)
    	at org.eclipse.ui.internal.console.ConsoleDocument.getLineOffset(ConsoleDocument.java:59)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getLineOffset(ConsoleDocumentAdapter.java:354)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getOffsetAtLine(ConsoleDocumentAdapter.java:332)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1099)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:984)
    	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:306)
    	at org.eclipse.swt.custom.StyledText.getVerticalScrollOffset(StyledText.java:5066)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4224)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4176)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8522)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8479)
    	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:10865)
    	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:6120)
    	at org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5442)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentChanged(ConsoleDocumentAdapter.java:588)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:708)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:692)
    	at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:766)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1091)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1109)
    	at org.eclipse.ui.internal.console.ConsoleDocument.replace(ConsoleDocument.java:74)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.trim(IOConsolePartitioner.java:1216)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.checkBufferSize(IOConsolePartitioner.java:438)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.processPendingPartitions(IOConsolePartitioner.java:808)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:763)
    	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)
    	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4135)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3751)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185)
    	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627)
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1403)
    
    !ENTRY org.eclipse.ui.console 4 120 2026-05-29 22:20:05.288
    !MESSAGE fixed width: false
    !STACK 0
    org.eclipse.jface.text.BadLocationException: 245
    	at org.eclipse.jface.text.TreeLineTracker.getLineInformation(TreeLineTracker.java:1153)
    	at org.eclipse.jface.text.AbstractLineTracker.getLineInformation(AbstractLineTracker.java:228)
    	at org.eclipse.jface.text.AbstractDocument.getLineInformation(AbstractDocument.java:873)
    	at org.eclipse.ui.internal.console.ConsoleDocument.getLineInformation(ConsoleDocument.java:44)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getLineInformation(ConsoleDocumentAdapter.java:249)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getLine(ConsoleDocumentAdapter.java:226)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1098)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:984)
    	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:306)
    	at org.eclipse.swt.custom.StyledText.getVerticalScrollOffset(StyledText.java:5066)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4224)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4176)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8522)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8479)
    	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:10865)
    	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:6120)
    	at org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5442)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentChanged(ConsoleDocumentAdapter.java:588)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:708)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:692)
    	at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:766)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1091)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1109)
    	at org.eclipse.ui.internal.console.ConsoleDocument.replace(ConsoleDocument.java:74)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.trim(IOConsolePartitioner.java:1216)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.checkBufferSize(IOConsolePartitioner.java:438)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.processPendingPartitions(IOConsolePartitioner.java:808)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:763)
    	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)
    	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4135)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3751)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185)
    	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627)
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1403)
    
    !ENTRY org.eclipse.ui.console 4 120 2026-05-29 22:20:05.289
    !MESSAGE fixed width: false
    !STACK 0
    org.eclipse.jface.text.BadLocationException: 245
    	at org.eclipse.jface.text.TreeLineTracker.offsetByLine(TreeLineTracker.java:335)
    	at org.eclipse.jface.text.TreeLineTracker.getLineOffset(TreeLineTracker.java:1101)
    	at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:252)
    	at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:868)
    	at org.eclipse.ui.internal.console.ConsoleDocument.getLineOffset(ConsoleDocument.java:59)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getLineOffset(ConsoleDocumentAdapter.java:354)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getOffsetAtLine(ConsoleDocumentAdapter.java:332)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1099)
    	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:984)
    	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:306)
    	at org.eclipse.swt.custom.StyledText.getVerticalScrollOffset(StyledText.java:5066)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4224)
    	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4176)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8522)
    	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8479)
    	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:10865)
    	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:6120)
    	at org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5442)
    	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentChanged(ConsoleDocumentAdapter.java:588)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:708)
    	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:692)
    	at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:766)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1091)
    	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1109)
    	at org.eclipse.ui.internal.console.ConsoleDocument.replace(ConsoleDocument.java:74)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.trim(IOConsolePartitioner.java:1216)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner.checkBufferSize(IOConsolePartitioner.java:438)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.processPendingPartitions(IOConsolePartitioner.java:808)
    	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:763)
    	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)
    	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4135)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3751)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185)
    	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627)
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1403)
    

    Do you have any insights? Thanks for any suggestions.

  6. iloveeclipse commented on May 29, 2026

    @iloveeclipse
    Contributor

    Just curious: how an error on Console update affects thinking block performance? I don't see any pointers to the Copilot code in the error stack? Or is the listener org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5442) added by Copilot? Why do you listen to console styled text?

    Beside this, the code runs in UI thread, it is exclusive and if some Copilot code tries to use UI thread at same time, it is a bottleneck of course. Not sure how much that all related to thinking blocks.

  7. jdneo commented on Jun 2, 2026

    @jdneo
    Member

    Most time cost happens at ChatContentViewer.processTurnEvent

    Image

    My take away:

    1. should not necessarily be sync
    2. Not all of the work should happen in ui thread.
  8. gvl2023 commented on Jun 3, 2026

    @gvl2023

    Subscribing. Sadly there isn't a way to disable reasoning blocks if they are indeed what's causing this performance issue.

  9. infinity202 commented on Jun 9, 2026

    @infinity202

    Performance Analysis: Slow Chat Output in GitHub Copilot for Eclipse

    Date: 2026-06-09
    Issue: Plugin outputs approximately 1 word per second when used in Eclipse
    Severity: Critical - Plugin is essentially unusable at current performance

    Executive Summary

    The copilot-for-eclipse plugin exhibits severe performance issues when displaying streamed chat responses, outputting only about 1 word per second. The root cause is an O(n²) markdown parsing operation combined with no debouncing/batching of UI updates, resulting in exponential slowdown as response text grows.


    Root Causes Identified

    1. O(n²) Markdown Parsing (Critical)

    Location: BaseTurnWidget.java (lines 225-243, 474-501) and ChatMarkupViewer.java (lines 66-79)

    Problem:

    • Every time a newline character arrives from the streaming response, processMessageLine() is called immediately
    • This triggers appendTextToTextViewer() which calls markupViewer.setMarkup(text)
    • ChatMarkupViewer.setMarkup() re-parses the entire accumulated markdown content every time via computeHtml()

    Impact:

    • As response text grows from 100 to 1000 characters, the markdown parser runs on increasingly larger content
    • This creates O(n²) complexity - if response has n characters, total parsing work is proportional to n²
    • For a 1000-character response: ~500,000 character-parsing operations
    // BaseTurnWidget.java - Line 225-243
    public void appendMessage(String message) {
        if (StringUtils.isEmpty(message)) {
            return;
        }
        messageBuffer.append(message);
        int newlineIndex;
        while ((newlineIndex = messageBuffer.indexOf("\n")) != -1) {
            String line = messageBuffer.substring(0, newlineIndex + 1);
            messageBuffer.delete(0, newlineIndex + 1);
            processMessageLine(line);  // Called for EVERY newline
        }
    }
    
    // ChatMarkupViewer.java - Line 66-79
    @Override
    public void setMarkup(String source) {
        try {
            String htmlText = this.computeHtml(source);  // FULL re-parse every time
            setHtml(htmlText);
        } catch (Throwable t) {
            // fallback
        }
    }

    2. No Debouncing/Batching Mechanism (Critical)

    Location: BaseTurnWidget.java, ChatContentViewer.java

    Problem:

    • No debouncing mechanism to batch multiple small chunks of text before rendering
    • UI is updated on every single newline character from the streaming response
    • Each update triggers full markdown parsing and SWT layout calculations

    Impact:

    • A 500-character response with newlines every 50 characters = 10 full markdown parses
    • Each parse operation becomes progressively slower as content grows

    3. Excessive UI Layout Calls (High)

    Location: ChatContentViewer.java, BaseTurnWidget.java, ThinkingBlock.java

    Problem:
    Every character update triggers multiple expensive operations:

    • requestLayout() calls
    • refreshScrollerLayout() calls
    • Full markdown re-parsing via computeHtml()
    • setOrigin() scroll adjustments
    • requestRefreshScrollerLayout() async scheduling
    // ChatContentViewer.java - Line 242-246
    refreshScrollerLayout();  // Called on every progress event
    if (shouldAutoScrollToBottom()) {
        scrollToBottom();
    }
    
    // ThinkingBlock.java - Line 104-105
    public void appendText(String fragment) {
        textBuffer.append(fragment);
        refreshBody();      // Full re-parse of thinking block
        requestLayout();   // Layout recalculation
    }

    Files and Methods Involved

    File Method Lines Impact
    BaseTurnWidget.java appendMessage() 225-243 Called on every newline
    BaseTurnWidget.java processMessageLine() 474-501 Parses and renders each line
    BaseTurnWidget.java appendTextToTextViewer() 511-521 Updates viewer with full content
    ChatMarkupViewer.java setMarkup() 66-79 Re-parses entire markdown
    ChatMarkupViewer.java computeHtml() 82-93 Markdown-to-HTML conversion
    ChatContentViewer.java processTurnEvent() 191-306 Main event handler
    ThinkingBlock.java appendText() 99-106 Thinking block updates
    ThinkingBlock.java refreshBody() 280-319 Re-parses thinking content

    Performance Analysis

    Current Behavior (O(n²)):

    Response Size | Parses | Avg Parse Cost | Total Time
    --------------|--------|----------------|------------
    100 chars     | 10     | 1ms           | 10ms
    500 chars     | 50     | 5ms           | 250ms
    1000 chars    | 100    | 10ms          | 1000ms
    5000 chars    | 500    | 50ms          | 25000ms
    

    Expected Behavior with Fix (O(n)):

    Response Size | Batches | Cost/Batch | Total Time
    --------------|---------|------------|------------
    100 chars     | 2       | 1ms        | 2ms
    500 chars     | 4       | 1ms        | 4ms
    1000 chars    | 8       | 1ms        | 8ms
    5000 chars    | 20      | 1ms        | 20ms
    

    Recommended Fixes

    Fix 1: Batch Text Updates (Priority: High)

    Accumulate text in the buffer and only update the UI periodically:

    // Add debouncing to BaseTurnWidget
    private ScheduledFuture<?> updateFuture;
    private static final int UPDATE_DEBOUNCE_MS = 50;
    
    public void appendMessage(String message) {
        if (StringUtils.isEmpty(message)) {
            return;
        }
        messageBuffer.append(message);
    
        // Cancel pending update
        if (updateFuture != null) {
            updateFuture.cancel(false);
        }
    
        // Schedule batched update
        updateFuture = SwtUtils.scheduleOnDisplayThread(() -> {
            flushMessageBuffer();
        }, UPDATE_DEBOUNCE_MS);
    }

    Fix 2: Incremental Document Updates (Priority: High)

    Instead of replacing entire markup, append to existing document:

    // In BaseTurnWidget.appendTextToTextViewer()
    private void appendTextToTextViewer(String text) {
        if (currentTextBlock == null) {
            this.createTextBlock();
            ensureFooterAtBottom();
        }
    
        if (currentTextBlock instanceof ChatMarkupViewer markupViewer) {
            // Get current document
            Document doc = markupViewer.getDocument();
            if (doc == null) {
                doc = new Document(text);
                markupViewer.setDocument(doc);
            } else {
                // Append incrementally
                int length = doc.getLength();
                doc.replace(length, 0, text);
            }
        } else {
            currentTextBlock.setDocument(new Document(text));
        }
    }

    Fix 3: Optimize Markdown Rendering (Priority: Medium)

    Add caching to ChatMarkupViewer to avoid re-parsing unchanged content:

    class ChatMarkupViewer extends MarkupViewer {
        private String lastMarkup;
    
        @Override
        public void setMarkup(String source) {
            // Only parse if content changed
            if (source.equals(lastMarkup)) {
                return;
            }
            lastMarkup = source;
            // ... existing parsing logic
        }
    }

    Fix 4: Use StyledText Directly for Plain Text (Priority: Medium)

    For non-markdown content, bypass the expensive markdown parser:

    // Check if text contains markdown syntax before using ChatMarkupViewer
    private boolean hasMarkdownSyntax(String text) {
        return text.contains("#") || text.contains("**")
            || text.contains("__") || text.contains("```");
    }
    
    private void appendTextToTextViewer(String text) {
        if (hasMarkdownSyntax(text) && currentTextBlock instanceof ChatMarkupViewer) {
            // Use markup viewer
        } else {
            // Use plain StyledText for faster display
            updatePlainTextViewer(text);
        }
    }

    Testing Recommendations

    1. Unit Tests:

      • Test appendMessage() with various text sizes (100, 1000, 10000 chars)
      • Verify debouncing behavior with rapid successive calls
      • Test incremental updates don't corrupt document state
    2. Integration Tests:

      • Measure time to display streaming responses of varying lengths
      • Compare CPU usage before and after fix
      • Test with real Copilot API responses
    3. Performance Metrics:

      • Time from text arrival to UI display
      • Number of markdown parses per response
      • Memory allocation during streaming

    Related Files to Review

    • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/BaseTurnWidget.java
    • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatMarkupViewer.java
    • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatContentViewer.java
    • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ThinkingBlock.java
    • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/SwtUtils.java

    Conclusion

    The severe performance issue is caused by fundamental architectural problems in the chat rendering pipeline:

    1. Immediate rendering on every character instead of batched updates
    2. Full markdown re-parsing instead of incremental updates
    3. No debouncing to coalesce rapid changes

    Implementing the recommended fixes should reduce rendering time from O(n²) to O(n), resulting in 10-100x improvement in chat response display performance.


    Analysis made by QWEN3.5b

  10. royrang commented on Jun 23, 2026

    @royrang

    Is there any update on this issue?
    I find that there may be 2 aspects of the slow issue:

    1. When you click the existing chat record which contains multiple turns, it takes much time to load and show all of the content. I find setMarkup() may consume most of the time since the "O(n²) complexity" issue.
    2. When you continue chat in the long conversation, you may get response more and more slowly. I find that the reason may because processTurnEvent() and refreshScrollerLayout() affect and block each other. processTurnEvent() is invoked when new message is received and it invokes SwtUtils.invokeOnDisplayThread() to directly to handle messages and create components and then invoke refreshScrollerLayout(). But UI thread may be blocked by last turn of refreshScrollerLayout(). So processTurnEvent() is blocked a lot by refreshScrollerLayout() eventually. I suggest that we should optimize processTurnEvent() with non-blocking operation.
  11. iloveeclipse commented on Jun 30, 2026

    @iloveeclipse
    Contributor

    Sheng Chen (@jdneo) : can we have a nightly build with this fix?

  12. jdneo commented on Jun 30, 2026

    @jdneo
    Member

    We just released a new nightly build which should improve the rendering efficiency a lot. Please have a try:

    1. Uninstall copilot from Eclipse
    2. Install from https://marketplace.eclipse.org/content/github-copilot-nightly

    // cc Andrey Loskutov (@iloveeclipse)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions