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

Add more debug profiling #24

Open
jackTabsCode opened this issue Jan 17, 2024 · 2 comments
Open

Add more debug profiling #24

jackTabsCode opened this issue Jan 17, 2024 · 2 comments
Labels
improvement An imperfection we can make better
Milestone

Comments

@jackTabsCode
Copy link
Contributor

jackTabsCode commented Jan 17, 2024

There is a lot of unprofiled or incorrectly profiled code in the library (see World:query). Profiling all parts of Matter will allow us to narrow down performance issues in Matter's internals.

@jackTabsCode jackTabsCode added the feature New feature or request label Jan 17, 2024
@LastTalon LastTalon added improvement An imperfection we can make better and removed feature New feature or request labels Jan 17, 2024
@Ukendio
Copy link
Member

Ukendio commented Jan 22, 2024

I agree with adding more diagnostics, but not for the same reason. We want to implement this to allow the users know how much the iteration is taking of their systems' times.

We may want to be careful with debug profiler as they add non trivial overhead which is problematic for iterators that run multiple times and I don't think O2 removes them.

If we just want to give people the query speeds in their systems, all we have to do is make our debugger call a query for each entity archetype, or cached queries, I am not sure. For this the debugger needs to hook the world which I think it already does at some point?

If we want to use it internally between ourselves to track performance issues, I suggest we make a test build of sorts that enables profiling. We shouldn't impose this on the users.

Side note: if you are just curious about the performance issues in the internals then most of the overhead from the query is clearly the expanding, where 60% of that function goes to unpack. And the rest goes to nextItem, maybe something to do with it doing extra gymnastics to prevent iterator invalidation.

@LastTalon LastTalon added this to the v0.9.0 milestone Jun 25, 2024
@jackTabsCode
Copy link
Contributor Author

I think that, especially with the world rewrite in progress, we should make sure code paths are accurately and extensively profiled. What if we had an API to enable debug profiling? That solves the overhead problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An imperfection we can make better
Projects
None yet
Development

No branches or pull requests

3 participants