mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-69317 Editor: Improve performance
Minor improvements to soft wraps recalculation
This commit is contained in:
+12
-3
@@ -180,13 +180,22 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
|
||||
myTabPositions.add(tabData);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
public void advance(final int offsetDiff) {
|
||||
startOffset += offsetDiff;
|
||||
endOffset += offsetDiff;
|
||||
for (TabData tabData : myTabPositions) {
|
||||
tabData.offset += offsetDiff;
|
||||
|
||||
// 'For-each' loop is not used here because this code is called quite often and profile shows the Iterator usage here
|
||||
// produces performance drawback.
|
||||
for (int i = 0; i < myTabPositions.size(); i++) {
|
||||
myTabPositions.get(i).offset += offsetDiff;
|
||||
}
|
||||
final TIntObjectHashMap<FoldingData> newFoldingData = new TIntObjectHashMap<FoldingData>();
|
||||
|
||||
if (myFoldingData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TIntObjectHashMap<FoldingData> newFoldingData = new TIntObjectHashMap<FoldingData>(myFoldingData.size());
|
||||
myFoldingData.forEachEntry(new TIntObjectProcedure<FoldingData>() {
|
||||
@Override
|
||||
public boolean execute(int offset, FoldingData foldingData) {
|
||||
|
||||
+6
-2
@@ -542,6 +542,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|
||||
* </ol>
|
||||
</pre>
|
||||
*/
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
private void applyStateChange(int offsetsDiff) {
|
||||
if (myNotAffectedByUpdateTailCacheEntries.isEmpty()) {
|
||||
return;
|
||||
@@ -565,7 +566,10 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|
||||
offsetsDiff));
|
||||
}
|
||||
|
||||
for (CacheEntry cacheEntry : myNotAffectedByUpdateTailCacheEntries) {
|
||||
// 'For-each' loop is not used here because this code is called quite often and profile shows the Iterator usage here
|
||||
// produces performance drawback.
|
||||
for (int i = 0; i < myNotAffectedByUpdateTailCacheEntries.size(); i++) {
|
||||
CacheEntry cacheEntry = myNotAffectedByUpdateTailCacheEntries.get(i);
|
||||
cacheEntry.visualLine += visualLinesDiff;
|
||||
cacheEntry.startLogicalLine += logicalLinesDiff;
|
||||
cacheEntry.endLogicalLine += logicalLinesDiff;
|
||||
@@ -574,7 +578,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|
||||
cacheEntry.endSoftWrapLinesBefore += softWrappedLinesDiff;
|
||||
cacheEntry.startFoldedLines += foldedLinesDiff;
|
||||
cacheEntry.endFoldedLines += foldedLinesDiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user