Skip to content

rb_method_basic_definition_p with CC #2629

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

Merged

Conversation

shyouhei
Copy link
Member

Noticed that rb_method_basic_definition_p is frequently called. Its callers include vm_caller_setup_args_block(), rb_hash_default_value(), rb_num_neative_int_p(), and a lot more.

It seems worth caching the method resolution part. Majority of rb_method_basic_definion_p() usages take fixed class and fixed method id combinations.

Calculating -------------------------------------
                           ours       trunk
           so_matrix      2.379       2.115 i/s -       1.000 times in 0.420409s 0.472879s

Comparison:
                        so_matrix
                ours:         2.4 i/s
               trunk:         2.1 i/s - 1.12x  slower

@shyouhei
Copy link
Member Author

This one conflicts with #2627. Must be updated once after that pull request was merged.

@tenderlove
Copy link
Member

@shyouhei what do you think about the approach in #2627. My goal is to make the call data reachable from the GC. Do you think there is a better approach?

Noticed that rb_method_basic_definition_p is frequently called.
Its callers include vm_caller_setup_args_block(),
rb_hash_default_value(), rb_num_neative_int_p(), and a lot more.

It seems worth caching the method resolution part.  Majority of
rb_method_basic_definion_p() usages take fixed class and fixed
method id combinations.

Calculating -------------------------------------
                           ours       trunk
           so_matrix      2.379       2.115 i/s -       1.000 times in 0.420409s 0.472879s

Comparison:
                        so_matrix
                ours:         2.4 i/s
               trunk:         2.1 i/s - 1.12x  slower
@shyouhei shyouhei force-pushed the rb_method_basic_definition_p_with_cc branch from fd971ce to 248fdd5 Compare October 31, 2019 04:34
@shyouhei
Copy link
Member Author

shyouhei commented Nov 4, 2019

Can I merge this?

@shyouhei shyouhei merged commit 6ff1250 into ruby:master Nov 5, 2019
@shyouhei shyouhei deleted the rb_method_basic_definition_p_with_cc branch November 5, 2019 02:39
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.

2 participants