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

YJIT: Show Context stats on exit #7327

Merged
merged 1 commit into from Feb 16, 2023
Merged

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Feb 16, 2023

As we started to discuss how we compress Context, I'd like to add stats about its size.

Through these metrics, I'd like to remind us that memory consumed by Context is currently not that dominant, but these stats will also be useful to notice it's getting more important as we add more fields to it.

Current stats

Current YJIT stats with stats build on railsbench 25 itrs:

compiled_iseq_count:           2,200
compiled_block_count:         20,675
compiled_branch_count:        36,009
...
code_region_size:          4,259,840
yjit_alloc_size:           9,159,933
live_context_size:         1,021,516
live_context_count:           26,882

Implementation design

I considered incrementing or decrementing the counter as it gets allocated or deallocated, but it seemed rather complicated. Scanning all at the end seems to make the implementation simple and precise. However, because it comes at the cost of scanning all payloads, these metrics are available only at exit by default.

@matzbot matzbot requested a review from a team February 16, 2023 18:53
Copy link
Contributor

@maximecb maximecb left a comment

Choose a reason for hiding this comment

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

Good to have these stats 👍

@k0kubun k0kubun merged commit 21f9c92 into ruby:master Feb 16, 2023
@k0kubun k0kubun deleted the yjit-context-stats branch February 16, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants