Top-20 not inlined C methods (95.5% of total 11,057,209):
Hash#key?: 4,524,984 (40.9%)
Array#find_index: 2,074,775 (18.8%)
Set#include?: 1,472,749 (13.3%)
String#===: 548,662 ( 5.0%)
Integer#<<: 315,268 ( 2.9%)
Integer#/: 235,142 ( 2.1%)
Kernel#format: 235,142 ( 2.1%)
Regexp.last_match: 178,041 ( 1.6%)
CGI::EscapeExt#escapeHTML: 104,971 ( 0.9%)
Array#shift: 96,891 ( 0.9%)
String#start_with?: 90,578 ( 0.8%)
String#=~: 89,862 ( 0.8%)
Array#unshift: 89,571 ( 0.8%)
Array#freeze: 84,986 ( 0.8%)
Regexp#===: 84,568 ( 0.8%)
Array#flatten!: 83,971 ( 0.8%)
String#gsub!: 68,551 ( 0.6%)
String#concat: 62,955 ( 0.6%)
String#gsub: 60,203 ( 0.5%)
String#[]: 58,541 ( 0.5%)
Top-20 calls to C functions from JIT code (92.6% of total 83,177,301):
rb_vm_opt_send_without_block: 29,397,272 (35.3%)
rb_vm_env_write: 13,533,262 (16.3%)
Hash#key?: 4,524,984 ( 5.4%)
rb_vm_splat_array: 4,008,147 ( 4.8%)
rb_vm_getinstancevariable: 3,700,519 ( 4.4%)
rb_ary_entry: 2,832,786 ( 3.4%)
Array#empty?: 2,712,391 ( 3.3%)
Array#each_index: 2,373,062 ( 2.9%)
find_index: 2,074,775 ( 2.5%)
rb_vm_send: 1,925,867 ( 2.3%)
rb_ivar_get_at_no_ractor_check: 1,565,524 ( 1.9%)
rb_gc_writebarrier: 1,510,029 ( 1.8%)
Set#include?: 1,472,749 ( 1.8%)
Array#map: 1,378,971 ( 1.7%)
rb_ec_ary_new_from_values: 818,933 ( 1.0%)
rb_str_concat_literals: 749,404 ( 0.9%)
rb_str_buf_append: 688,452 ( 0.8%)
Array#each: 685,873 ( 0.8%)
String#===: 548,662 ( 0.7%)
rb_hash_aref: 542,599 ( 0.7%)
Top-1 not optimized method types for send (100.0% of total 389,059):
iseq: 389,059 (100.0%)
Top-1 not optimized method types for send_without_block (100.0% of total 223,884):
optimized_send: 223,884 (100.0%)
Top-3 instructions with uncategorized fallback reason (100.0% of total 439,936):
invokeblock: 423,621 (96.3%)
invokesuper: 15,775 ( 3.6%)
opt_send_without_block: 540 ( 0.1%)
Top-11 send fallback reasons (100.0% of total 31,762,535):
send_without_block_polymorphic: 15,712,787 (49.5%)
one_or_more_complex_arg_pass: 9,766,130 (30.7%)
send_without_block_no_profiles: 3,774,378 (11.9%)
send_no_profiles: 1,320,486 ( 4.2%)
uncategorized: 439,936 ( 1.4%)
send_not_optimized_method_type: 389,059 ( 1.2%)
send_without_block_not_optimized_method_type_optimized: 223,884 ( 0.7%)
send_polymorphic: 132,059 ( 0.4%)
obj_to_string_not_string: 2,477 ( 0.0%)
too_many_args_for_lir: 1,329 ( 0.0%)
send_megamorphic: 10 ( 0.0%)
Top-1 setivar fallback reasons (100.0% of total 6,164):
not_monomorphic: 6,164 (100.0%)
Top-1 getivar fallback reasons (100.0% of total 3,700,519):
not_monomorphic: 3,700,519 (100.0%)
Top-1 definedivar fallback reasons (100.0% of total 1):
not_monomorphic: 1 (100.0%)
Top-2 invokeblock handler (100.0% of total 423,621):
monomorphic_iseq: 334,050 (78.9%)
polymorphic: 89,571 (21.1%)
Top-4 popular complex argument-parameter features not optimized (100.0% of total 9,766,130):
param_kw_opt: 5,589,760 (57.2%)
caller_splat: 4,008,147 (41.0%)
caller_blockarg: 84,253 ( 0.9%)
param_rest: 83,970 ( 0.9%)
Top-1 compile error reasons (100.0% of total 1,446,807):
exception_handler: 1,446,807 (100.0%)
Top-1 unhandled YARV insns (100.0% of total 129):
once: 129 (100.0%)
Top-1 unhandled HIR insns (100.0% of total 663,600):
throw: 663,600 (100.0%)
Top-9 side exit reasons (100.0% of total 15,935,837):
guard_shape_failure: 7,635,175 (47.9%)
guard_type_failure: 6,189,288 (38.8%)
compile_error: 1,446,807 ( 9.1%)
unhandled_hir_insn: 663,600 ( 4.2%)
patchpoint_stable_constant_names: 659 ( 0.0%)
patchpoint_method_redefined: 133 ( 0.0%)
unhandled_yarv_insn: 129 ( 0.0%)
block_param_proxy_not_iseq_or_ifunc: 44 ( 0.0%)
interrupt: 2 ( 0.0%)
send_count: 111,417,836
dynamic_send_count: 31,762,535 (28.5%)
optimized_send_count: 79,655,301 (71.5%)
dynamic_setivar_count: 6,164 ( 0.0%)
dynamic_getivar_count: 3,700,519 ( 3.3%)
dynamic_definedivar_count: 1 ( 0.0%)
iseq_optimized_send_count: 25,957,782 (23.3%)
inline_cfunc_optimized_send_count: 32,742,312 (29.4%)
inline_iseq_optimized_send_count: 5,370,067 ( 4.8%)
non_variadic_cfunc_optimized_send_count: 12,291,839 (11.0%)
variadic_cfunc_optimized_send_count: 3,293,301 ( 3.0%)
compiled_iseq_count: 408
failed_iseq_count: 0
compile_time: 309ms
profile_time: 699ms
gc_time: 11ms
invalidation_time: 0ms
vm_write_pc_count: 82,083,176
vm_write_sp_count: 82,083,176
vm_write_locals_count: 80,079,053
vm_write_stack_count: 80,079,053
vm_write_to_parent_iseq_local_count: 2,610,032
vm_read_from_parent_iseq_local_count: 26,968,062
guard_type_count: 120,692,248
guard_type_exit_ratio: 5.1%
guard_shape_count: 40,672,753
guard_shape_exit_ratio: 18.8%
code_region_bytes: 1,523,712
zjit_alloc_bytes: 1,799,318
total_mem_bytes: 3,323,030
side_exit_count: 15,935,837
total_insn_count: 883,760,648
vm_insn_count: 332,999,269
zjit_insn_count: 550,761,379
ratio_in_zjit: 62.3%
This issue aims to make ZJIT as fast as YJIT on the
liquid-renderbenchmark in yjit-bench.Stats as of Dec 9:
Details
ratio_in_zjit: 62.3%Burndown list
Reduce side exits (
side exit reasons)ratio_in_zjitis low compared to Rails benchmarks.To improve it we need to reduce
side exit reasonsand their sub-category reasons:register_spill_on_allocZJIT: Support spilling in the register allocator #716guard_shape_failureZJIT: guard_shape_failure happens too frequently on ruby-bench #727guard_type_failureZJIT: guard_type_failure happens too frequently on lobsters #771unhandled_splatZJIT: Compile VM_CALL_ARGS_SPLAT #749unhandled_kwargZJIT: Compile VM_CALL_KWARG #750Reduce dynamic sends (
send fallback reasons)not_optimized_instructionopt_send_without_blockZJIT: Support compilingSendwithout dynamic dispatch #777opt_arefZJIT: Optimize opt_aref #775invokeblocksend_without_block_polymorphicZJIT: send_without_block_polymorphic happens too frequently #776send_without_block_no_profilessend_without_block_no_profilesComplex argument-parameter features not optimized
Not optimized method types for send
send#825Extra