aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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
commit82cf750633468024da8f304fc5c956036c929f4b (patch)
treeeaf97cb3f6325ebf45d79c8a7a353fc36d8de8b2 /src
parent4147f4121d028c9db7ad5229b4980b2b98249a93 (diff)
downloadscintilla-mirror-82cf750633468024da8f304fc5c956036c929f4b.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')
-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;
}