ChunkedArrayTextStore
is a chunked-array based implementation of the
TextStore class, together with a hierarchical marker storage representation.
ChunkedArrayTextStore [public]
TextStore
For most purposes, this is the most efficient TextStore
Led provides. It
uses a chunked array implementation
to keep track of the text, and a tree-like structure for keeping track of markers.
The implementation is far more complex than that of SimpleTextStore
.
so for understanding purposes, or as a starting point for a different sort of TextStore, this is probably not
a good choice.
A "chunked array" is a data structure that mixes an array with a linked list, to get most of the performance benefits of the two. It is a linked list of fixed-length array of Led_tChars (the chunks). Insertions don't have the usual problem with arrays, because you only have to shuffle bytes down up to a fixed maximum distance (to the end of the chunk). But lookups of a region of text typically are as quick as with arrays, since most operations you do on text are localized within a particular chunk.
The representation of the markers however, is more novel, and clever. Basically, we use a tree-structure, where the organization of the tree naturally mimics the container/contains relationship among the markers. This allows for rapidly adjusting marker offsets during text updates, and rapidly finding all the markers in a particular subrange of the buffer.
qKeepChunkedArrayStatistics [public]
Slight debugging aid. Tells you how many existing markers are out there, and a few other statistics. This just keeps track of the given variables. To see them - you must peek in the debugger at the ChunkedArrayTextStore's instance variables.
Turn ON iff qDebug
- by default.
qUseLRUCacheForRecentlyLookedUpMarkers [public]
Small speed tweek. Conditionally compiled cuz I'm not sure its always a speed tweek. In the case of a problem sent to me (SPR#0652) - this had a 20% speedup. And in other cases I tested (e.g. reading RTF 1.4 RTF doc) - no noticable difference. Maybe a 5% speedup on Cut/Paste/Paste operation after opening a file with 3X RTF 1.4 RTF.
Turn ON by default