Skip to content

Conversation

@k0kubun
Copy link
Member

@k0kubun k0kubun commented Nov 15, 2022

We currently invalidate redefined methods in two different ways: klass and cme. If we modify the invalidation logic in C (clear_method_cache_by_id_in_class) a little, we could always do that through cme, which allows us to save some memory.

This contributes to reducing YJIT's memory consumption on railsbench (23.3MB -> 22.2MB):

Before

inline_code_size:         4845340
outlined_code_size:       4843608
freed_code_size:                0
yjit_alloc_size:         23284693

After

inline_code_size:         4843240
outlined_code_size:       4842316
freed_code_size:                0
yjit_alloc_size:         22198049

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
@matzbot matzbot requested a review from a team November 15, 2022 20:00
@maximecb maximecb requested a review from XrXr November 15, 2022 20:02
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.

Looks like a nice simplification 👍 Thank you for looking into things like this 🙏

@XrXr can you review this as well?

Copy link
Member

@XrXr XrXr left a comment

Choose a reason for hiding this comment

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

Should be good if CI passes 👍🏼

@k0kubun k0kubun merged commit 1125274 into ruby:master Nov 15, 2022
@k0kubun k0kubun deleted the yjit-invalidate-cme branch November 15, 2022 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants