mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
IJPL-164422 DocumentImpl: do not create new changedPart if it's a String
This code was initially written to avoid dragging along with the changed part some huge chunks of text in case this value is some complicated implementation of CharSequence. But if it's just a String, turning it into a smart immutable char sequence has no benefit but may slow down things. Notably, this change noticeably improves the performance of LineSet.isSingleLineChange. (cherry picked from commit 86ef29d3ba08dc7eaf7a51127449afcb92ae6d27) IJ-CR-157364 GitOrigin-RevId: 7665d77ae115dc643393fe4a7515b60fcf4c1f60
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b534b067fb
commit
4d23dca10c
@@ -686,7 +686,9 @@ public final class DocumentImpl extends UserDataHolderBase implements DocumentEx
|
||||
}
|
||||
else {
|
||||
newText = myText.replace(startOffset, endOffset, changedPart);
|
||||
changedPart = newText.subtext(startOffset, startOffset + changedPart.length());
|
||||
if (!(changedPart instanceof String)) {
|
||||
changedPart = newText.subtext(startOffset, startOffset + changedPart.length());
|
||||
}
|
||||
}
|
||||
boolean wasOptimized = initialStartOffset != startOffset || endOffset - startOffset != initialOldLength;
|
||||
updateText(newText, startOffset, sToDelete, changedPart, wholeTextReplaced, newModificationStamp,
|
||||
|
||||
Reference in New Issue
Block a user