Bug 578506

Summary: multiline edit is way to slow (ui freeze)
Product: [Eclipse Project] Platform Reporter: Jörg Kubitz <jkubitz-eclipse>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: Dirk.Steinkamp
Version: 4.22   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Screenshot sampling.png
none
Screenshot invocation Count for 100 lines.png none

Description Jörg Kubitz CLA 2022-02-01 07:06:12 EST
Created attachment 287944 [details]
Screenshot sampling.png

reproduce:
1. create a file "test.txt"
2. insert 1000 lines: "hello world"\n
3. Find "world" & "Select All"
=>  already "Select all" is slow .. playing an animation of selecting one after the other, but ok...
4. exit the search dialog
5. type "eclipse" (to replace the "world" with "eclipse").
 
=> freeze for some minutes!

even "Replace all" is faster

And when i meanwhile switch the application not even all characters have been replaced.
Comment 1 Jörg Kubitz CLA 2022-02-01 07:53:37 EST
Created attachment 287945 [details]
Screenshot invocation Count for 100 lines.png

To get an idea of the problem i did recorded the invocation count during replacing only n=100 lines. One can see that AbstractDocument.replace is called n times and then n Events are created and then O(n^2) OS calls happen.

kinda strange to see that getLineCount() is that expensive and called so often.