Skip to content

ZJIT: Specialize send with param_rest #1003

Description

@k0kubun

On erubi-rails,

Top-20 send fallback reasons (100.0% of total 1,679,667):
                             invokeblock_not_specialized: 617,810 (36.8%)
                            one_or_more_complex_arg_pass: 321,562 (19.1%)
                          send_without_block_no_profiles: 277,692 (16.5%)
                          send_without_block_polymorphic: 213,232 (12.7%)
  send_without_block_not_optimized_method_type_optimized:  56,086 ( 3.3%)
                                   too_many_args_for_lir:  53,183 ( 3.2%)
                                        send_polymorphic:  24,226 ( 1.4%)

Next to invokeblock_not_specialized, one_or_more_complex_arg_pass is the #2 fallback reason.

Top-7 popular complex argument-parameter features not optimized (100.0% of total 361,616):
         param_rest: 184,347 (51.0%)
    caller_blockarg:  95,923 (26.5%)
  param_forwardable:  39,884 (11.0%)
       caller_splat:  31,298 ( 8.7%)
       caller_kwarg:   9,973 ( 2.8%)
       param_kwrest:     130 ( 0.0%)
    caller_kw_splat:      61 ( 0.0%)

param_rest accounts for 51% of one_or_more_complex_arg_pass on erubi-rails.

TODO

  1. Specialize send with param_rest, allocating an array for the rest parameter
  2. Investigate whether there are array allocations we can optimize away if the caller and the callee are inlined
  3. Consider optimizing away such array allocation
    • We need to make sure the array doesn't escape

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions