LL perf (Core): LLTrace re-activates LLViewerStats::mRecording every frame #373

Closed
opened 2026-10-04 14:09:32 +00:00 by sky_line · 0 comments
Owner

From the LL-origin inefficiency audit (finding C2). File/line references are from commit 0229f8872c; re-locate them before working.

LLTrace re-activates LLViewerStats::mRecording every frame

  • Mechanism:
    • doFrame calls nextPeriod() on the frame recording (llappviewer.cpp:1659), which makes it current.
    • getSum/getPerSec on the non-current viewer-stats recording then call update(), which does deactivate() (merge every buffer down the stack) plus activate() (new ActiveRecording with four new[] buffers sized to every stat). Re-read at lltracerecording.cpp:92-113.
    • Triggered from update_statistics() (llviewerstats.cpp:497) and LLWorld::updateNetStats() (llworld.cpp:829, 832).
  • Also per frame: getPeriodMeanPerSec(FPS) walks 200 periods (:499); stat_type_t::getInstance("Frame") does a mutex plus string lookup (:480).
  • Fix: read from the just-closed period, or plain counters; static handle; running mean.
  • Confirmed. S-M.

Verify the cost (profile or timer) before and after changing it.

From the LL-origin inefficiency audit (finding C2). File/line references are from commit 0229f8872c; re-locate them before working. **LLTrace re-activates `LLViewerStats::mRecording` every frame** - **Mechanism:** - `doFrame` calls `nextPeriod()` on the frame recording (`llappviewer.cpp:1659`), which makes it current. - `getSum`/`getPerSec` on the non-current viewer-stats recording then call `update()`, which does `deactivate()` (merge every buffer down the stack) plus `activate()` (`new ActiveRecording` with four `new[]` buffers sized to every stat). Re-read at `lltracerecording.cpp:92-113`. - Triggered from `update_statistics()` (`llviewerstats.cpp:497`) and `LLWorld::updateNetStats()` (`llworld.cpp:829, 832`). - **Also per frame:** `getPeriodMeanPerSec(FPS)` walks 200 periods (`:499`); `stat_type_t::getInstance("Frame")` does a mutex plus string lookup (`:480`). - **Fix:** read from the just-closed period, or plain counters; static handle; running mean. - Confirmed. S-M. Verify the cost (profile or timer) before and after changing it.
sky_line added this to the Slipstream project 2026-10-06 15:04:14 +00:00
sky_line referenced this issue from a commit 2026-10-06 20:15:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#373
No description provided.