Bug 196116 - [painting] Long lines take too long to display when "Show Whitespace Characters" is enabled.
Summary: [painting] Long lines take too long to display when "Show Whitespace Characte...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Anton Leherbauer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, performance
Depends on:
Blocks:
 
Reported: 2007-07-11 04:05 EDT by Dani Megert CLA
Modified: 2007-11-22 04:36 EST (History)
3 users (show)

See Also:


Attachments
Fix (5.62 KB, patch)
2007-09-05 08:35 EDT, Anton Leherbauer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-07-11 04:05:02 EDT
+++ This bug was initially created as a clone of Bug #195575 +++

Build ID: I20070625-1500

Steps To Reproduce:
1. Enable the "Show Whitespace Characters" feature.
2. Open a file containing a long line of data (>100 kB works well) in a text-based editor (text editor, or XML editor in Source mode).
3. Observe that Eclipse becomes unresponsive for 30+ seconds with 100% CPU utilization in Eclipse.exe.

Turning off the "Show Whitespace Characters" feature reduces this to about < 3 seconds.

More information:
Test machine is 2 GHz with 2 GB RAM, running Win2k.
Comment 1 Dani Megert CLA 2007-07-11 04:06:45 EDT
Besides StyledText.getLocationAtOffset(int) being slow (see bug 195575) the WhitespaceCharacterPainter could be improved by not looping from start to end offset but instead do it line by line so that we can cut off at left and right of the viewport. Left and right need to be computed à la binary seach to minimize the calls to getLocationAtOffset(int).
Comment 2 Anton Leherbauer CLA 2007-09-05 08:35:16 EDT
Created attachment 77716 [details]
Fix

This patch improves performance for long lines by computing the visible part of each line before painting. Binary search was not necessary.
Comment 3 Mark A. Ziesemer CLA 2007-09-07 14:02:15 EDT
I've patched my installation with this fix, and now there is no noticeable difference between opening "long line" files with or without whitespace characters enabled.  Looks good to me!
Comment 4 Dani Megert CLA 2007-09-11 04:58:34 EDT
Thanks Anton!

Committed to HEAD.
Available in builds >= I20070911-0800.