Skip to content

Comments

ref: Improve view hierarchy performance#373

Merged
limbonaut merged 42 commits intomainfrom
ref/optimize-view-hierarchy
Sep 22, 2025
Merged

ref: Improve view hierarchy performance#373
limbonaut merged 42 commits intomainfrom
ref/optimize-view-hierarchy

Conversation

@limbonaut
Copy link
Collaborator

@limbonaut limbonaut commented Sep 17, 2025

This PR improves performance of scene tree data capture (more commonly known as view hierarchy in Sentry).
This mostly improves JSON construction by reducing redundant memory allocations using large specialized memory buffer and "in-place" utf8 conversion. It benefits both small and large scene trees. With large trees I've recorded 4 to 5 times improvement in generation speed. Overall speed improvement taking file IO into account is around 3x for optimistic scene tree size of 4000 nodes.
I also noticed a small improvement in file IO, likely due to avoiding extra copy.

Synthetic tests

For the tests, I've added 3905 nodes 5 levels deep, each with 5 children.

// Before this PR
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=3.189ms, last=3.133ms, min=3.000ms, max=3.425ms
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=3.023ms, last=3.007ms, min=2.808ms, max=3.352ms
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=3.081ms, last=2.985ms, min=2.938ms, max=3.306ms

// After this PR
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=0.676ms, last=0.701ms, min=0.641ms, max=1.044ms
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=0.663ms, last=0.667ms, min=0.624ms, max=0.843ms
Sentry: DEBUG: Performance stats:
  Phase "process vh": runs=100, avg=0.702ms, last=0.688ms, min=0.632ms, max=1.193ms

@limbonaut limbonaut marked this pull request as ready for review September 18, 2025 14:55
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Collaborator

@jpnurmi jpnurmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive improvement :)

@limbonaut limbonaut force-pushed the ref/optimize-view-hierarchy branch from 178b437 to 8726999 Compare September 19, 2025 12:56
Update view_hierarchy_processor.cpp
@limbonaut limbonaut force-pushed the ref/optimize-view-hierarchy branch from 8726999 to 5a4cdb7 Compare September 19, 2025 12:58
@limbonaut
Copy link
Collaborator Author

Thanks for the suggestions, @jpnurmi

@limbonaut limbonaut merged commit fe98ff7 into main Sep 22, 2025
84 of 85 checks passed
@limbonaut limbonaut deleted the ref/optimize-view-hierarchy branch September 22, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve view hierarchy performance

2 participants