Performance improvement for find & replace all in Batch Mode.
This is an improvement of the search & replace all in text editors/java editors/xtext editors etc. Instead of replacing all occurrences one by one (and notify document change), it replaces all occurrences at once and then notifies the document change (document.set(..) ).
As this feature is only for users which have huge files in their workspace, I've added the ability to turn this feature on/off. For better reusability I had to refactor the two private methods (asRegPattern, substituteLineBreak) in FindReplaceDocumentAdapter and move them into org.eclipse.jface.text.internal.RegExUtils class as public static methods and adjusted the callees to call the refactored methods.
The batch replace was tested with 20.000 occurrences (Java Editor, around 50% improvement and xtext editor about 40%) .. Opening the Java file in plain text editor improved more than 90%.
@iloveeclipse Do you have time to look into this PR?
Rebased on the Latest master..
I think a document.set() will replace all annotations on the document, too. Can you confirm that bookmarks survive that operation?
Oh you're right.. I will look into this how this works.. Maybe I can find the damage regions and feed it one by one ..
Test Results
1 815 files ±0 1 815 suites ±0 1h 43m 54s :stopwatch: + 13m 25s 7 699 tests ±0 7 471 :white_check_mark: ±0 228 :zzz: ±0 0 :x: ±0 24 258 runs ±0 23 511 :white_check_mark: ±0 747 :zzz: ±0 0 :x: ±0
Results for commit e973066e. ± Comparison against base commit a43889de.
@Wittmaxi Thanks for the review. But with this PR i stumbled over the blocker, that all IMarkers are lost.. Tasks, Bookmarks and Breakpoints.. I would be able to move them programmatically after all replaces but from this bundle I don't have an access to IMarkers.. There is much more effort needed than just putting a method which replaces in a string.. Only improvement is what we can do from here just execute the Batch Replace if there are no Annotations in the current open file, otherwise execute the original search and replace..
Only improvement is what we can do from here just execute the Batch Replace if there are no Annotations in the current open file, otherwise execute the original search and replace..
Do we have case with editors without annotations (except plain text edito)? I believe even generic editor (with tm4e) shows expand/collapse regions for supported code?