aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PerLine.cxx
diff options
context:
space:
mode:
authorJiří Techet <techet@gmail.com>2015-06-09 11:57:54 +0200
committerJiří Techet <techet@gmail.com>2015-06-09 11:57:54 +0200
commita4dc7ce7752fb6be0df5f8dbbdac6866ffec130a (patch)
tree1b7cf759be7f84cdea90332605cdaca7813b3cce /src/PerLine.cxx
parent3baaa70160d6cc63b907597d2523a79fe168c0ff (diff)
downloadscintilla-mirror-a4dc7ce7752fb6be0df5f8dbbdac6866ffec130a.tar.gz
When combining MarkerHandlerSets, prepend the other set instead of appending
When undoing many lines with markers (e.g. "changebar" markers) LineMarkers::RemoveLine() is called for many lines and as a result combining markers from the next line for all the removed lines. This may cause the list contains many thousands of elements and traversing it becomes expensive. When lines are removed from the beginning to the end, it's better to prepend the markers from the next line to the current line instead of appending them because the current line "accumulates" all the markers from the following lines and walking the whole list takes more and more time.
Diffstat (limited to 'src/PerLine.cxx')
-rw-r--r--src/PerLine.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/PerLine.cxx b/src/PerLine.cxx
index 8fd96cbed..14d89e100 100644
--- a/src/PerLine.cxx
+++ b/src/PerLine.cxx
@@ -108,11 +108,12 @@ bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) {
}
void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
- MarkerHandleNumber **pmhn = &root;
+ MarkerHandleNumber **pmhn = &other->root;
while (*pmhn) {
pmhn = &((*pmhn)->next);
}
- *pmhn = other->root;
+ *pmhn = root;
+ root = other->root;
other->root = 0;
}