Bug 276265 - [BlockSelection] StyledText.getSelectionRanges() is very slow on large text
Summary: [BlockSelection] StyledText.getSelectionRanges() is very slow on large text
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact: Felipe Heidrich CLA
URL:
Whiteboard: stalebug
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2009-05-14 04:08 EDT by Dani Megert CLA
Modified: 2020-07-05 14:43 EDT (History)
3 users (show)

See Also:


Attachments
Perf Data (6.82 KB, application/x-zip-compressed)
2009-05-14 04:10 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2009-05-14 04:08:13 EDT
I20090513-2000.

When having large text (e.g. StyledText.java) in the text editor and then select all the editor becomes unresponsive. The reason for this is slow performance of StyledText.getSelectionRanges().
Comment 1 Dani Megert CLA 2009-05-14 04:10:01 EDT
Created attachment 135752 [details]
Perf Data
Comment 2 Felipe Heidrich CLA 2009-05-14 10:59:54 EDT
Not sure what to do the improve the performance here.

Here is the problem, the block selection is a geometry shape on top of the text.
When the user call getSelectionRanges(), StyledText finds the line at the top edge of the block selection and the line at the bottom. Then it loops from that first line to the last line finding the offsets in each line that intersect with the left and right edge of block selection.

If the application calls select all, all lines are select. If the file is StyledText, which has 9425 lines of code. It means that getSelectionRanges() will have to perform 9425*2 hit tests. Note also that only a few lines will be in the cache (the lines in the client area), for the majority of lines StyledText will have to initialize them.

That said, I can add a special case: detect when the block selection rectangle entirely covers the document and return {0, charCount} in getSelectionRanges(). This should fix the selectAll()/getSelectionRanges() problem.

The generic case: 'block selection rectangle too large makes getSelectionRanges() slow', that I don't know how to fix.

Comment 3 Felipe Heidrich CLA 2009-05-14 13:17:25 EDT
I didn't notice select all getting faster using the patch in bug 276345 (getSelectionRanges is not running), can you profile again with the patch ?
Comment 4 Felipe Heidrich CLA 2009-08-14 14:52:17 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 5 Leo Ufimtsev CLA 2017-08-03 12:30:19 EDT
This is a one-off bulk update. (The last one in the triage migration).

Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process:
https://wiki.eclipse.org/SWT/Devel/Triage

See Bug 518478 for details.

Tag for notification/mail filters:
@TriageBulkUpdate
Comment 6 Eclipse Genie CLA 2020-07-05 14:43:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.