Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize TimeHistogram #6065

Closed
emilk opened this issue Apr 22, 2024 · 0 comments · Fixed by #6934
Closed

Optimize TimeHistogram #6065

emilk opened this issue Apr 22, 2024 · 0 comments · Fixed by #6934
Assignees
Labels
enhancement New feature or request 📉 performance Optimization, memory use, etc

Comments

@emilk
Copy link
Member

emilk commented Apr 22, 2024

The TimeHistogram is what enables this view in the time panel:

Screenshot 2024-04-22 at 17 42 07

When we have a lot of entires this becomes a memory hog because each time entry is cached in multiple TimeHistograms: one for the component, one for the parent Entity, and then once more for each ancestor Entity.

Suggested solution

Now that everything is chunks, we should have a very chunk-centric solution to this. Each chunk should have rough statistics of its contents per component, per timelines. At least number of entries for each column, and the time span on each timeline. We could optionally have a time histogram computer per chunk (stored in a cache, evicted when not read). Each ChunkTimeHistogram is either a full TimeHistogram (same as current code) or just "number of entries over this time span", if the number of entries is above some threshold (e.g. 100k).

Then each frame we do:

  • Find all chunks that overlap the current query (time-range + entity path)
  • Get the ChunkTimeHistogram for each chunk
  • Merge them into a visual histogram, and render that

When hovering, we just do a range query (hovered time ± 3pixels) so we can do a tooltip.

@emilk emilk added enhancement New feature or request 📉 performance Optimization, memory use, etc labels Apr 22, 2024
@emilk emilk changed the title Rethink TimeHistogram Optimize TimeHistogram Jul 8, 2024
@emilk emilk added this to the 0.18 - Chunks milestone Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 📉 performance Optimization, memory use, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants