aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 18971dc99..9ca6db7a3 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -368,6 +368,17 @@ LineLayoutCache::LineLayoutCache() :
LineLayoutCache::~LineLayoutCache() = default;
+namespace {
+
+constexpr size_t AlignUp(size_t value, size_t alignment) noexcept {
+ return ((value - 1) / alignment + 1) * alignment;
+}
+
+constexpr size_t alignmentLLC = 20;
+
+}
+
+
size_t LineLayoutCache::EntryForLine(Sci::Line line) const noexcept {
switch (level) {
case Cache::none:
@@ -388,9 +399,9 @@ void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesI
if (level == Cache::caret) {
lengthForLevel = 1;
} else if (level == Cache::page) {
- lengthForLevel = linesOnScreen + 1;
+ lengthForLevel = AlignUp(linesOnScreen + 1, alignmentLLC);
} else if (level == Cache::document) {
- lengthForLevel = linesInDoc;
+ lengthForLevel = AlignUp(linesInDoc, alignmentLLC);
}
if (lengthForLevel != cache.size()) {