diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-01-15 06:24:41 +0200 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-01-15 06:24:41 +0200 |
| commit | 04db46f0b12c894983fdb1bb783fbad9d5a11943 (patch) | |
| tree | dbc9903b400d5bdda4f318f1d56ad8c39bbfb70d | |
| parent | 69cdf5c0f584617ef57a7168a64ee52f64451b12 (diff) | |
#5278 Reduce reallocs
| -rw-r--r-- | indra/llui/llkeywords.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index bbcb45f100..c4272401b9 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -506,6 +506,8 @@ 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); const llwchar* base = wtext.c_str(); const llwchar* cur = base; diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 68c4077b89..2a4c2b9d0b 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -443,6 +443,7 @@ void LLScriptEditor::queueSyntaxApply(LLWString text, resetPendingSyntaxApply(); + // Small updates can apply synchronously; larger ones use background slices. constexpr size_t kImmediateOpsThreshold = 500; if (ops.size() <= kImmediateOpsThreshold) { @@ -481,6 +482,7 @@ void LLScriptEditor::processPendingSyntaxApply() return; } + // Slice sizes control UI budget while applying large highlight updates. constexpr size_t kOpsPerSlice = 250; constexpr size_t kSegmentsPerSlice = 250; |
