diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-01-15 13:15:01 +0200 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-01-15 13:15:01 +0200 |
| commit | d86785b28a69d2a10808e5dc2f2d0588a7be5768 (patch) | |
| tree | 8fcb03ea34a224fc6846ca179ca23c5939367376 /indra/llui/llkeywords.cpp | |
| parent | 04db46f0b12c894983fdb1bb783fbad9d5a11943 (diff) | |
#5278 Reuse average segment length heuristic
Diffstat (limited to 'indra/llui/llkeywords.cpp')
| -rw-r--r-- | indra/llui/llkeywords.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index c4272401b9..fd9991fd11 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -497,6 +497,7 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o } LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); +constexpr size_t AVERAGE_SEGMENT_LENGTH = 8; void LLKeywords::collectSegmentOps(segment_ops_t& ops, const LLWString& wtext, bool disable_syntax_highlighting) const { @@ -507,7 +508,7 @@ void LLKeywords::collectSegmentOps(segment_ops_t& ops, const LLWString& wtext, b return; } // Heuristic to reduce reallocation churn on large scripts. - ops.reserve(wtext.size() / 8); + ops.reserve(wtext.size() / AVERAGE_SEGMENT_LENGTH); const llwchar* base = wtext.c_str(); const llwchar* cur = base; @@ -848,7 +849,6 @@ bool LLKeywords::applySegmentOpsRange(std::vector<LLTextSegmentPtr> *seg_list, // Clear the segment list seg_list->clear(); // Reserve capacity for segments based on an estimated average of 8 characters per segment. - constexpr size_t AVERAGE_SEGMENT_LENGTH = 8; seg_list->reserve(wtext.size() / AVERAGE_SEGMENT_LENGTH); S32 text_len = static_cast<S32>(wtext.size()) + 1; |
