forked from ruby/ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] master from ruby:master #725
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closes: Shopify#862 Add dynamic dispatch for `invokesuperforward` instruction as a first step. Specialization like YJIT’s is not implemented yet and will be handled separately. ## Benchmark ### lobsters <details> <summary>before patch</summary> ``` Average of last 10, non-warmup iters: 654ms ***ZJIT: Printing ZJIT statistics on exit*** Top-20 not inlined C methods (59.5% of total 15,599,811): Hash#fetch: 3,185,110 (20.4%) Regexp#match?: 708,802 ( 4.5%) Hash#key?: 696,422 ( 4.5%) String#sub!: 489,840 ( 3.1%) Set#include?: 396,625 ( 2.5%) String#<<: 396,279 ( 2.5%) String#start_with?: 379,336 ( 2.4%) Hash#delete: 325,992 ( 2.1%) String.new: 307,248 ( 2.0%) Integer#===: 279,054 ( 1.8%) Symbol#end_with?: 255,539 ( 1.6%) Kernel#is_a?: 246,961 ( 1.6%) Process.clock_gettime: 221,588 ( 1.4%) Integer#>: 219,718 ( 1.4%) String#match?: 218,056 ( 1.4%) Integer#<=: 202,617 ( 1.3%) Time#to_i: 192,214 ( 1.2%) Time#subsec: 189,240 ( 1.2%) String#to_sym: 185,593 ( 1.2%) String#include?: 182,862 ( 1.2%) Top-20 calls to C functions from JIT code (83.7% of total 126,406,213): rb_vm_opt_send_without_block: 37,054,888 (29.3%) rb_vm_send: 10,068,319 ( 8.0%) rb_vm_env_write: 8,529,584 ( 6.7%) rb_hash_aref: 8,014,188 ( 6.3%) rb_zjit_writebarrier_check_immediate: 7,697,828 ( 6.1%) rb_vm_getinstancevariable: 5,954,987 ( 4.7%) rb_ivar_get_at_no_ractor_check: 4,759,191 ( 3.8%) rb_obj_is_kind_of: 3,722,656 ( 2.9%) rb_vm_invokesuper: 2,663,433 ( 2.1%) rb_hash_aset: 2,416,121 ( 1.9%) rb_vm_setinstancevariable: 2,355,463 ( 1.9%) rb_vm_opt_getconstant_path: 2,297,784 ( 1.8%) Hash#fetch: 1,779,524 ( 1.4%) fetch: 1,405,586 ( 1.1%) rb_vm_invokeblock: 1,385,970 ( 1.1%) rb_str_buf_append: 1,369,178 ( 1.1%) rb_ec_ary_new_from_values: 1,336,805 ( 1.1%) rb_class_allocate_instance: 1,281,590 ( 1.0%) rb_hash_new_with_size: 899,859 ( 0.7%) rb_vm_sendforward: 798,572 ( 0.6%) Top-2 not optimized method types for send (100.0% of total 4,889,764): iseq: 4,886,942 (99.9%) null: 2,822 ( 0.1%) Top-3 not optimized method types for send_without_block (100.0% of total 525,349): optimized_send: 478,875 (91.2%) null: 42,175 ( 8.0%) optimized_block_call: 4,299 ( 0.8%) Top-3 not optimized method types for super (100.0% of total 2,350,295): cfunc: 2,239,567 (95.3%) alias: 107,374 ( 4.6%) attrset: 3,354 ( 0.1%) Top-3 instructions with uncategorized fallback reason (100.0% of total 2,216,938): invokeblock: 1,385,970 (62.5%) sendforward: 798,572 (36.0%) opt_send_without_block: 32,396 ( 1.5%) Top-20 send fallback reasons (99.9% of total 51,971,182): send_without_block_polymorphic: 18,639,354 (35.9%) singleton_class_seen: 9,274,307 (17.8%) send_without_block_no_profiles: 7,217,551 (13.9%) send_not_optimized_method_type: 4,889,764 ( 9.4%) send_no_profiles: 2,882,604 ( 5.5%) super_not_optimized_method_type: 2,350,295 ( 4.5%) uncategorized: 2,216,938 ( 4.3%) one_or_more_complex_arg_pass: 1,543,405 ( 3.0%) send_without_block_megamorphic: 723,037 ( 1.4%) send_polymorphic: 544,570 ( 1.0%) send_without_block_not_optimized_method_type_optimized: 483,174 ( 0.9%) send_without_block_not_optimized_need_permission: 390,366 ( 0.8%) too_many_args_for_lir: 312,568 ( 0.6%) super_complex_args_pass: 111,053 ( 0.2%) super_target_complex_args_pass: 104,723 ( 0.2%) super_polymorphic: 87,851 ( 0.2%) argc_param_mismatch: 50,382 ( 0.1%) send_without_block_not_optimized_method_type: 42,175 ( 0.1%) obj_to_string_not_string: 34,861 ( 0.1%) send_without_block_direct_keyword_mismatch: 32,436 ( 0.1%) Top-4 setivar fallback reasons (100.0% of total 2,355,463): not_monomorphic: 2,132,748 (90.5%) not_t_object: 125,163 ( 5.3%) too_complex: 97,531 ( 4.1%) new_shape_needs_extension: 21 ( 0.0%) Top-2 getivar fallback reasons (100.0% of total 6,080,097): not_monomorphic: 5,808,527 (95.5%) too_complex: 271,570 ( 4.5%) Top-3 definedivar fallback reasons (100.0% of total 405,302): not_monomorphic: 397,150 (98.0%) too_complex: 5,122 ( 1.3%) not_t_object: 3,030 ( 0.7%) Top-6 invokeblock handler (100.0% of total 1,385,970): monomorphic_iseq: 688,147 (49.7%) polymorphic: 523,864 (37.8%) monomorphic_other: 106,268 ( 7.7%) monomorphic_ifunc: 55,505 ( 4.0%) megamorphic: 6,762 ( 0.5%) no_profiles: 5,424 ( 0.4%) Top-8 popular complex argument-parameter features not optimized (100.0% of total 1,850,659): param_forwardable: 685,936 (37.1%) param_block: 641,355 (34.7%) param_rest: 327,046 (17.7%) param_kwrest: 120,210 ( 6.5%) caller_kw_splat: 36,147 ( 2.0%) caller_splat: 34,029 ( 1.8%) caller_blockarg: 5,826 ( 0.3%) caller_kwarg: 110 ( 0.0%) Top-1 compile error reasons (100.0% of total 191,769): exception_handler: 191,769 (100.0%) Top-6 unhandled YARV insns (100.0% of total 89,278): invokesuperforward: 81,667 (91.5%) getconstant: 3,318 ( 3.7%) setblockparam: 2,837 ( 3.2%) checkmatch: 929 ( 1.0%) expandarray: 360 ( 0.4%) once: 167 ( 0.2%) Top-3 unhandled HIR insns (100.0% of total 236,976): throw: 198,481 (83.8%) invokebuiltin: 35,774 (15.1%) array_max: 2,721 ( 1.1%) Top-20 side exit reasons (100.0% of total 15,409,202): guard_type_failure: 6,871,609 (44.6%) guard_shape_failure: 6,854,409 (44.5%) block_param_proxy_not_iseq_or_ifunc: 1,008,346 ( 6.5%) unhandled_hir_insn: 236,976 ( 1.5%) compile_error: 191,769 ( 1.2%) unhandled_yarv_insn: 89,278 ( 0.6%) fixnum_mult_overflow: 50,739 ( 0.3%) block_param_proxy_modified: 28,119 ( 0.2%) patchpoint_stable_constant_names: 19,872 ( 0.1%) unhandled_newarray_send_pack: 14,481 ( 0.1%) unhandled_block_arg: 13,787 ( 0.1%) fixnum_lshift_overflow: 10,085 ( 0.1%) patchpoint_no_ep_escape: 7,815 ( 0.1%) expandarray_failure: 4,532 ( 0.0%) guard_super_method_entry: 4,475 ( 0.0%) patchpoint_method_redefined: 1,212 ( 0.0%) patchpoint_no_singleton_class: 1,130 ( 0.0%) obj_to_string_fallback: 275 ( 0.0%) guard_less_failure: 163 ( 0.0%) interrupt: 111 ( 0.0%) send_count: 152,221,918 dynamic_send_count: 51,971,182 (34.1%) optimized_send_count: 100,250,736 (65.9%) dynamic_setivar_count: 2,355,463 ( 1.5%) dynamic_getivar_count: 6,080,097 ( 4.0%) dynamic_definedivar_count: 405,302 ( 0.3%) iseq_optimized_send_count: 40,162,692 (26.4%) inline_cfunc_optimized_send_count: 40,296,415 (26.5%) inline_iseq_optimized_send_count: 3,344,046 ( 2.2%) non_variadic_cfunc_optimized_send_count: 8,915,909 ( 5.9%) variadic_cfunc_optimized_send_count: 7,531,674 ( 4.9%) compiled_iseq_count: 5,554 failed_iseq_count: 0 compile_time: 1,779ms profile_time: 13ms gc_time: 19ms invalidation_time: 248ms vm_write_pc_count: 133,179,978 vm_write_sp_count: 133,179,978 vm_write_locals_count: 129,160,863 vm_write_stack_count: 129,160,863 vm_write_to_parent_iseq_local_count: 693,262 vm_read_from_parent_iseq_local_count: 14,736,626 guard_type_count: 157,425,618 guard_type_exit_ratio: 4.4% guard_shape_count: 64,005,824 guard_shape_exit_ratio: 10.7% code_region_bytes: 29,147,136 zjit_alloc_bytes: 44,468,338 total_mem_bytes: 73,615,474 side_exit_count: 15,409,202 total_insn_count: 934,468,730 vm_insn_count: 166,726,703 zjit_insn_count: 767,742,027 ratio_in_zjit: 82.2% ``` </details> <details> <summary>after patch</summary> ``` Average of last 10, non-warmup iters: 648ms ***ZJIT: Printing ZJIT statistics on exit*** Top-20 not inlined C methods (59.5% of total 15,571,939): Hash#fetch: 3,185,114 (20.5%) Regexp#match?: 708,795 ( 4.6%) Hash#key?: 696,422 ( 4.5%) String#sub!: 489,841 ( 3.1%) Set#include?: 396,625 ( 2.5%) String#<<: 396,279 ( 2.5%) String#start_with?: 370,465 ( 2.4%) Hash#delete: 325,992 ( 2.1%) String.new: 307,248 ( 2.0%) Integer#===: 277,929 ( 1.8%) Symbol#end_with?: 255,540 ( 1.6%) Kernel#is_a?: 246,961 ( 1.6%) Process.clock_gettime: 221,588 ( 1.4%) Integer#>: 219,718 ( 1.4%) String#match?: 218,057 ( 1.4%) Integer#<=: 202,617 ( 1.3%) Time#to_i: 192,214 ( 1.2%) Time#subsec: 189,240 ( 1.2%) String#to_sym: 185,593 ( 1.2%) String#include?: 182,863 ( 1.2%) Top-20 calls to C functions from JIT code (83.7% of total 126,248,940): rb_vm_opt_send_without_block: 36,875,422 (29.2%) rb_vm_send: 10,068,311 ( 8.0%) rb_vm_env_write: 8,529,572 ( 6.8%) rb_hash_aref: 8,014,184 ( 6.3%) rb_zjit_writebarrier_check_immediate: 7,697,776 ( 6.1%) rb_vm_getinstancevariable: 5,934,206 ( 4.7%) rb_ivar_get_at_no_ractor_check: 4,759,185 ( 3.8%) rb_obj_is_kind_of: 3,745,913 ( 3.0%) rb_vm_invokesuper: 2,663,429 ( 2.1%) rb_hash_aset: 2,416,112 ( 1.9%) rb_vm_setinstancevariable: 2,361,107 ( 1.9%) rb_vm_opt_getconstant_path: 2,294,768 ( 1.8%) Hash#fetch: 1,779,524 ( 1.4%) fetch: 1,405,590 ( 1.1%) rb_vm_invokeblock: 1,385,975 ( 1.1%) rb_str_buf_append: 1,369,179 ( 1.1%) rb_ec_ary_new_from_values: 1,336,806 ( 1.1%) rb_class_allocate_instance: 1,281,533 ( 1.0%) rb_hash_new_with_size: 899,857 ( 0.7%) rb_vm_sendforward: 798,572 ( 0.6%) Top-2 not optimized method types for send (100.0% of total 4,889,758): iseq: 4,886,936 (99.9%) null: 2,822 ( 0.1%) Top-3 not optimized method types for send_without_block (100.0% of total 525,350): optimized_send: 478,875 (91.2%) null: 42,176 ( 8.0%) optimized_block_call: 4,299 ( 0.8%) Top-3 not optimized method types for super (100.0% of total 2,350,289): cfunc: 2,239,565 (95.3%) alias: 107,374 ( 4.6%) attrset: 3,350 ( 0.1%) Top-4 instructions with uncategorized fallback reason (100.0% of total 2,298,609): invokeblock: 1,385,975 (60.3%) sendforward: 798,572 (34.7%) invokesuperforward: 81,666 ( 3.6%) opt_send_without_block: 32,396 ( 1.4%) Top-20 send fallback reasons (99.9% of total 51,873,375): send_without_block_polymorphic: 18,540,291 (35.7%) singleton_class_seen: 9,210,394 (17.8%) send_without_block_no_profiles: 7,202,051 (13.9%) send_not_optimized_method_type: 4,889,758 ( 9.4%) send_no_profiles: 2,882,602 ( 5.6%) super_not_optimized_method_type: 2,350,289 ( 4.5%) uncategorized: 2,298,609 ( 4.4%) one_or_more_complex_arg_pass: 1,543,404 ( 3.0%) send_without_block_megamorphic: 723,037 ( 1.4%) send_polymorphic: 544,570 ( 1.0%) send_without_block_not_optimized_method_type_optimized: 483,174 ( 0.9%) send_without_block_not_optimized_need_permission: 389,384 ( 0.8%) too_many_args_for_lir: 312,568 ( 0.6%) super_complex_args_pass: 111,054 ( 0.2%) super_target_complex_args_pass: 104,723 ( 0.2%) super_polymorphic: 87,852 ( 0.2%) argc_param_mismatch: 50,382 ( 0.1%) send_without_block_not_optimized_method_type: 42,176 ( 0.1%) obj_to_string_not_string: 34,853 ( 0.1%) send_without_block_direct_keyword_mismatch: 32,436 ( 0.1%) Top-4 setivar fallback reasons (100.0% of total 2,361,107): not_monomorphic: 2,138,392 (90.6%) not_t_object: 125,163 ( 5.3%) too_complex: 97,531 ( 4.1%) new_shape_needs_extension: 21 ( 0.0%) Top-2 getivar fallback reasons (100.0% of total 6,059,319): not_monomorphic: 5,787,746 (95.5%) too_complex: 271,573 ( 4.5%) Top-3 definedivar fallback reasons (100.0% of total 405,302): not_monomorphic: 397,150 (98.0%) too_complex: 5,122 ( 1.3%) not_t_object: 3,030 ( 0.7%) Top-6 invokeblock handler (100.0% of total 1,385,975): monomorphic_iseq: 688,157 (49.7%) polymorphic: 523,861 (37.8%) monomorphic_other: 106,268 ( 7.7%) monomorphic_ifunc: 55,505 ( 4.0%) megamorphic: 6,760 ( 0.5%) no_profiles: 5,424 ( 0.4%) Top-8 popular complex argument-parameter features not optimized (100.0% of total 1,850,658): param_forwardable: 685,941 (37.1%) param_block: 641,355 (34.7%) param_rest: 327,046 (17.7%) param_kwrest: 120,209 ( 6.5%) caller_kw_splat: 36,147 ( 2.0%) caller_splat: 34,029 ( 1.8%) caller_blockarg: 5,821 ( 0.3%) caller_kwarg: 110 ( 0.0%) Top-1 compile error reasons (100.0% of total 191,769): exception_handler: 191,769 (100.0%) Top-5 unhandled YARV insns (100.0% of total 7,611): getconstant: 3,318 (43.6%) setblockparam: 2,837 (37.3%) checkmatch: 929 (12.2%) expandarray: 360 ( 4.7%) once: 167 ( 2.2%) Top-3 unhandled HIR insns (100.0% of total 236,976): throw: 198,481 (83.8%) invokebuiltin: 35,774 (15.1%) array_max: 2,721 ( 1.1%) Top-20 side exit reasons (100.0% of total 15,343,302): guard_type_failure: 6,886,972 (44.9%) guard_shape_failure: 6,854,835 (44.7%) block_param_proxy_not_iseq_or_ifunc: 1,008,346 ( 6.6%) unhandled_hir_insn: 236,976 ( 1.5%) compile_error: 191,769 ( 1.2%) fixnum_mult_overflow: 50,739 ( 0.3%) block_param_proxy_modified: 28,119 ( 0.2%) patchpoint_stable_constant_names: 19,858 ( 0.1%) unhandled_newarray_send_pack: 14,481 ( 0.1%) unhandled_block_arg: 13,787 ( 0.1%) fixnum_lshift_overflow: 10,085 ( 0.1%) patchpoint_no_ep_escape: 7,815 ( 0.1%) unhandled_yarv_insn: 7,611 ( 0.0%) expandarray_failure: 4,533 ( 0.0%) guard_super_method_entry: 4,475 ( 0.0%) patchpoint_method_redefined: 1,212 ( 0.0%) patchpoint_no_singleton_class: 1,130 ( 0.0%) obj_to_string_fallback: 275 ( 0.0%) guard_less_failure: 163 ( 0.0%) interrupt: 102 ( 0.0%) send_count: 152,019,764 dynamic_send_count: 51,873,375 (34.1%) optimized_send_count: 100,146,389 (65.9%) dynamic_setivar_count: 2,361,107 ( 1.6%) dynamic_getivar_count: 6,059,319 ( 4.0%) dynamic_definedivar_count: 405,302 ( 0.3%) iseq_optimized_send_count: 40,149,182 (26.4%) inline_cfunc_optimized_send_count: 40,168,875 (26.4%) inline_iseq_optimized_send_count: 3,408,619 ( 2.2%) non_variadic_cfunc_optimized_send_count: 8,896,927 ( 5.9%) variadic_cfunc_optimized_send_count: 7,522,786 ( 4.9%) compiled_iseq_count: 5,554 failed_iseq_count: 0 compile_time: 1,784ms profile_time: 13ms gc_time: 19ms invalidation_time: 261ms vm_write_pc_count: 133,027,580 vm_write_sp_count: 133,027,580 vm_write_locals_count: 129,024,228 vm_write_stack_count: 129,024,228 vm_write_to_parent_iseq_local_count: 693,264 vm_read_from_parent_iseq_local_count: 14,727,716 guard_type_count: 157,500,381 guard_type_exit_ratio: 4.4% guard_shape_count: 64,160,894 guard_shape_exit_ratio: 10.7% code_region_bytes: 29,196,288 zjit_alloc_bytes: 44,686,498 total_mem_bytes: 73,882,786 side_exit_count: 15,343,302 total_insn_count: 934,219,385 vm_insn_count: 167,485,651 zjit_insn_count: 766,733,734 ratio_in_zjit: 82.1% ``` </details> ### rails-bench <details> <summary>before patch</summary> ``` Average of last 10, non-warmup iters: 1146ms ***ZJIT: Printing ZJIT statistics on exit*** Top-20 not inlined C methods (52.4% of total 38,306,776): Hash#key?: 3,141,619 ( 8.2%) Regexp#match?: 2,420,225 ( 6.3%) Hash#fetch: 2,245,557 ( 5.9%) Integer#===: 1,098,163 ( 2.9%) Hash#delete: 1,014,375 ( 2.6%) Array#any?: 1,007,766 ( 2.6%) String.new: 1,004,713 ( 2.6%) String#b: 797,913 ( 2.1%) String#to_sym: 680,943 ( 1.8%) Array#all?: 650,132 ( 1.7%) Fiber.current: 649,003 ( 1.7%) Array#join: 641,038 ( 1.7%) Array#include?: 613,837 ( 1.6%) Kernel#Array: 610,311 ( 1.6%) String#<<: 606,240 ( 1.6%) Symbol#end_with?: 598,807 ( 1.6%) String#force_encoding: 593,535 ( 1.5%) Kernel#dup: 580,051 ( 1.5%) Array#[]: 562,360 ( 1.5%) Kernel#respond_to?: 550,441 ( 1.4%) Top-20 calls to C functions from JIT code (75.5% of total 262,197,810): rb_vm_opt_send_without_block: 54,534,682 (20.8%) rb_hash_aref: 22,920,285 ( 8.7%) rb_vm_env_write: 19,385,633 ( 7.4%) rb_vm_send: 17,070,477 ( 6.5%) rb_zjit_writebarrier_check_immediate: 13,780,973 ( 5.3%) rb_vm_getinstancevariable: 12,379,513 ( 4.7%) rb_ivar_get_at_no_ractor_check: 12,156,906 ( 4.6%) rb_vm_invokesuper: 8,086,665 ( 3.1%) rb_hash_aset: 5,043,536 ( 1.9%) rb_obj_is_kind_of: 4,431,123 ( 1.7%) rb_vm_invokeblock: 4,036,483 ( 1.5%) Hash#key?: 3,141,619 ( 1.2%) rb_vm_opt_getconstant_path: 3,053,319 ( 1.2%) rb_class_allocate_instance: 2,878,526 ( 1.1%) rb_hash_new_with_size: 2,823,745 ( 1.1%) rb_ec_ary_new_from_values: 2,585,553 ( 1.0%) rb_str_concat_literals: 2,450,764 ( 0.9%) Regexp#match?: 2,420,225 ( 0.9%) rb_obj_alloc: 2,419,171 ( 0.9%) rb_vm_setinstancevariable: 2,357,067 ( 0.9%) Top-2 not optimized method types for send (100.0% of total 8,550,760): iseq: 8,518,289 (99.6%) optimized: 32,471 ( 0.4%) Top-2 not optimized method types for send_without_block (100.0% of total 789,641): optimized_send: 606,885 (76.9%) null: 182,756 (23.1%) Top-2 not optimized method types for super (100.0% of total 6,689,859): cfunc: 6,640,180 (99.3%) attrset: 49,679 ( 0.7%) Top-3 instructions with uncategorized fallback reason (100.0% of total 5,962,039): invokeblock: 4,036,483 (67.7%) sendforward: 1,871,601 (31.4%) opt_send_without_block: 53,955 ( 0.9%) Top-20 send fallback reasons (100.0% of total 85,599,908): send_without_block_polymorphic: 31,804,276 (37.2%) send_without_block_no_profiles: 13,349,825 (15.6%) send_not_optimized_method_type: 8,550,760 (10.0%) super_not_optimized_method_type: 6,689,859 ( 7.8%) uncategorized: 5,962,039 ( 7.0%) send_no_profiles: 5,200,278 ( 6.1%) one_or_more_complex_arg_pass: 4,198,502 ( 4.9%) send_polymorphic: 3,318,658 ( 3.9%) send_without_block_not_optimized_need_permission: 1,274,177 ( 1.5%) too_many_args_for_lir: 1,139,487 ( 1.3%) singleton_class_seen: 1,101,973 ( 1.3%) super_complex_args_pass: 829,842 ( 1.0%) send_without_block_not_optimized_method_type_optimized: 606,885 ( 0.7%) send_without_block_megamorphic: 565,874 ( 0.7%) super_target_complex_args_pass: 414,600 ( 0.5%) send_without_block_not_optimized_method_type: 182,756 ( 0.2%) obj_to_string_not_string: 158,141 ( 0.2%) super_call_with_block: 100,004 ( 0.1%) send_without_block_direct_keyword_mismatch: 99,588 ( 0.1%) super_polymorphic: 52,360 ( 0.1%) Top-2 setivar fallback reasons (100.0% of total 2,357,067): not_monomorphic: 2,255,283 (95.7%) not_t_object: 101,784 ( 4.3%) Top-1 getivar fallback reasons (100.0% of total 12,379,538): not_monomorphic: 12,379,538 (100.0%) Top-2 definedivar fallback reasons (100.0% of total 350,548): not_monomorphic: 350,461 (100.0%) not_t_object: 87 ( 0.0%) Top-6 invokeblock handler (100.0% of total 4,036,483): monomorphic_iseq: 2,189,057 (54.2%) polymorphic: 1,207,002 (29.9%) monomorphic_other: 334,248 ( 8.3%) monomorphic_ifunc: 221,225 ( 5.5%) megamorphic: 84,439 ( 2.1%) no_profiles: 512 ( 0.0%) Top-8 popular complex argument-parameter features not optimized (100.0% of total 5,212,154): param_forwardable: 1,824,953 (35.0%) param_block: 1,792,214 (34.4%) param_rest: 861,894 (16.5%) caller_splat: 283,669 ( 5.4%) caller_kw_splat: 248,291 ( 4.8%) param_kwrest: 200,208 ( 3.8%) caller_blockarg: 752 ( 0.0%) caller_kwarg: 173 ( 0.0%) Top-1 compile error reasons (100.0% of total 391,562): exception_handler: 391,562 (100.0%) Top-6 unhandled YARV insns (100.0% of total 1,000,531): invokesuperforward: 498,993 (49.9%) getconstant: 400,945 (40.1%) expandarray: 49,985 ( 5.0%) setblockparam: 49,972 ( 5.0%) checkmatch: 480 ( 0.0%) once: 156 ( 0.0%) Top-2 unhandled HIR insns (100.0% of total 268,151): throw: 232,560 (86.7%) invokebuiltin: 35,591 (13.3%) Top-19 side exit reasons (100.0% of total 8,709,784): guard_shape_failure: 2,497,335 (28.7%) block_param_proxy_not_iseq_or_ifunc: 1,988,408 (22.8%) guard_type_failure: 1,722,007 (19.8%) unhandled_yarv_insn: 1,000,531 (11.5%) compile_error: 391,562 ( 4.5%) unhandled_newarray_send_pack: 298,017 ( 3.4%) unhandled_hir_insn: 268,151 ( 3.1%) patchpoint_method_redefined: 200,632 ( 2.3%) unhandled_block_arg: 151,295 ( 1.7%) block_param_proxy_modified: 124,245 ( 1.4%) guard_less_failure: 50,126 ( 0.6%) fixnum_lshift_overflow: 9,985 ( 0.1%) patchpoint_stable_constant_names: 6,350 ( 0.1%) fixnum_mult_overflow: 570 ( 0.0%) obj_to_string_fallback: 405 ( 0.0%) patchpoint_no_ep_escape: 109 ( 0.0%) interrupt: 42 ( 0.0%) guard_super_method_entry: 8 ( 0.0%) guard_greater_eq_failure: 6 ( 0.0%) send_count: 329,199,237 dynamic_send_count: 85,599,908 (26.0%) optimized_send_count: 243,599,329 (74.0%) dynamic_setivar_count: 2,357,067 ( 0.7%) dynamic_getivar_count: 12,379,538 ( 3.8%) dynamic_definedivar_count: 350,548 ( 0.1%) iseq_optimized_send_count: 93,946,576 (28.5%) inline_cfunc_optimized_send_count: 97,478,983 (29.6%) inline_iseq_optimized_send_count: 9,138,886 ( 2.8%) non_variadic_cfunc_optimized_send_count: 25,367,116 ( 7.7%) variadic_cfunc_optimized_send_count: 17,667,768 ( 5.4%) compiled_iseq_count: 2,888 failed_iseq_count: 0 compile_time: 876ms profile_time: 28ms gc_time: 6ms invalidation_time: 8ms vm_write_pc_count: 287,051,837 vm_write_sp_count: 287,051,837 vm_write_locals_count: 273,948,883 vm_write_stack_count: 273,948,883 vm_write_to_parent_iseq_local_count: 1,079,877 vm_read_from_parent_iseq_local_count: 30,814,984 guard_type_count: 310,888,965 guard_type_exit_ratio: 0.6% guard_shape_count: 108,669,058 guard_shape_exit_ratio: 2.3% code_region_bytes: 14,352,384 zjit_alloc_bytes: 18,992,674 total_mem_bytes: 33,345,058 side_exit_count: 8,709,784 total_insn_count: 1,705,856,454 vm_insn_count: 122,246,885 zjit_insn_count: 1,583,609,569 ratio_in_zjit: 92.8% ``` </details> <details> <summary>after patch</summary> ``` Average of last 10, non-warmup iters: 1072ms ***ZJIT: Printing ZJIT statistics on exit*** Top-20 not inlined C methods (52.5% of total 38,239,504): Hash#key?: 3,141,619 ( 8.2%) Regexp#match?: 2,420,215 ( 6.3%) Hash#fetch: 2,245,557 ( 5.9%) Integer#===: 1,097,515 ( 2.9%) Hash#delete: 1,014,375 ( 2.7%) Array#any?: 1,007,756 ( 2.6%) String.new: 1,004,713 ( 2.6%) String#b: 797,913 ( 2.1%) String#to_sym: 680,943 ( 1.8%) Array#all?: 650,132 ( 1.7%) Fiber.current: 649,003 ( 1.7%) Array#join: 641,038 ( 1.7%) Array#include?: 613,837 ( 1.6%) Kernel#Array: 610,311 ( 1.6%) String#<<: 606,240 ( 1.6%) Symbol#end_with?: 598,807 ( 1.6%) String#force_encoding: 593,535 ( 1.6%) Kernel#dup: 580,051 ( 1.5%) Array#[]: 562,360 ( 1.5%) Kernel#respond_to?: 550,441 ( 1.4%) Top-20 calls to C functions from JIT code (75.4% of total 262,218,592): rb_vm_opt_send_without_block: 54,249,429 (20.7%) rb_hash_aref: 22,920,271 ( 8.7%) rb_vm_env_write: 19,385,609 ( 7.4%) rb_vm_send: 17,070,463 ( 6.5%) rb_zjit_writebarrier_check_immediate: 13,780,893 ( 5.3%) rb_vm_getinstancevariable: 12,322,924 ( 4.7%) rb_ivar_get_at_no_ractor_check: 12,156,898 ( 4.6%) rb_vm_invokesuper: 8,086,659 ( 3.1%) rb_hash_aset: 5,043,532 ( 1.9%) rb_obj_is_kind_of: 4,474,826 ( 1.7%) rb_vm_invokeblock: 4,036,471 ( 1.5%) Hash#key?: 3,141,619 ( 1.2%) rb_vm_opt_getconstant_path: 3,053,286 ( 1.2%) rb_class_allocate_instance: 2,878,505 ( 1.1%) rb_hash_new_with_size: 2,823,748 ( 1.1%) rb_ec_ary_new_from_values: 2,585,561 ( 1.0%) rb_str_concat_literals: 2,450,756 ( 0.9%) Regexp#match?: 2,420,215 ( 0.9%) rb_obj_alloc: 2,419,146 ( 0.9%) rb_vm_setinstancevariable: 2,357,065 ( 0.9%) Top-2 not optimized method types for send (100.0% of total 8,550,755): iseq: 8,518,284 (99.6%) optimized: 32,471 ( 0.4%) Top-2 not optimized method types for send_without_block (100.0% of total 789,641): optimized_send: 606,885 (76.9%) null: 182,756 (23.1%) Top-2 not optimized method types for super (100.0% of total 6,689,853): cfunc: 6,640,178 (99.3%) attrset: 49,675 ( 0.7%) Top-4 instructions with uncategorized fallback reason (100.0% of total 6,461,020): invokeblock: 4,036,471 (62.5%) sendforward: 1,871,601 (29.0%) invokesuperforward: 498,993 ( 7.7%) opt_send_without_block: 53,955 ( 0.8%) Top-20 send fallback reasons (100.0% of total 85,813,616): send_without_block_polymorphic: 31,519,543 (36.7%) send_without_block_no_profiles: 13,349,751 (15.6%) send_not_optimized_method_type: 8,550,755 (10.0%) super_not_optimized_method_type: 6,689,853 ( 7.8%) uncategorized: 6,461,020 ( 7.5%) send_no_profiles: 5,200,273 ( 6.1%) one_or_more_complex_arg_pass: 4,198,498 ( 4.9%) send_polymorphic: 3,318,658 ( 3.9%) send_without_block_not_optimized_need_permission: 1,273,739 ( 1.5%) too_many_args_for_lir: 1,139,487 ( 1.3%) singleton_class_seen: 1,101,973 ( 1.3%) super_complex_args_pass: 829,842 ( 1.0%) send_without_block_not_optimized_method_type_optimized: 606,885 ( 0.7%) send_without_block_megamorphic: 565,874 ( 0.7%) super_target_complex_args_pass: 414,600 ( 0.5%) send_without_block_not_optimized_method_type: 182,756 ( 0.2%) obj_to_string_not_string: 158,133 ( 0.2%) super_call_with_block: 100,004 ( 0.1%) send_without_block_direct_keyword_mismatch: 99,588 ( 0.1%) super_polymorphic: 52,360 ( 0.1%) Top-2 setivar fallback reasons (100.0% of total 2,357,065): not_monomorphic: 2,255,281 (95.7%) not_t_object: 101,784 ( 4.3%) Top-1 getivar fallback reasons (100.0% of total 12,322,949): not_monomorphic: 12,322,949 (100.0%) Top-2 definedivar fallback reasons (100.0% of total 350,548): not_monomorphic: 350,461 (100.0%) not_t_object: 87 ( 0.0%) Top-6 invokeblock handler (100.0% of total 4,036,471): monomorphic_iseq: 2,189,045 (54.2%) polymorphic: 1,207,002 (29.9%) monomorphic_other: 334,248 ( 8.3%) monomorphic_ifunc: 221,225 ( 5.5%) megamorphic: 84,439 ( 2.1%) no_profiles: 512 ( 0.0%) Top-8 popular complex argument-parameter features not optimized (100.0% of total 5,212,150): param_forwardable: 1,824,953 (35.0%) param_block: 1,792,214 (34.4%) param_rest: 861,894 (16.5%) caller_splat: 283,669 ( 5.4%) caller_kw_splat: 248,291 ( 4.8%) param_kwrest: 200,208 ( 3.8%) caller_blockarg: 748 ( 0.0%) caller_kwarg: 173 ( 0.0%) Top-1 compile error reasons (100.0% of total 391,562): exception_handler: 391,562 (100.0%) Top-5 unhandled YARV insns (100.0% of total 501,538): getconstant: 400,945 (79.9%) expandarray: 49,985 (10.0%) setblockparam: 49,972 (10.0%) checkmatch: 480 ( 0.1%) once: 156 ( 0.0%) Top-2 unhandled HIR insns (100.0% of total 268,152): throw: 232,560 (86.7%) invokebuiltin: 35,592 (13.3%) Top-19 side exit reasons (100.0% of total 8,210,699): guard_shape_failure: 2,497,552 (30.4%) block_param_proxy_not_iseq_or_ifunc: 1,988,408 (24.2%) guard_type_failure: 1,721,809 (21.0%) unhandled_yarv_insn: 501,538 ( 6.1%) compile_error: 391,562 ( 4.8%) unhandled_newarray_send_pack: 298,017 ( 3.6%) unhandled_hir_insn: 268,152 ( 3.3%) patchpoint_method_redefined: 200,632 ( 2.4%) unhandled_block_arg: 151,295 ( 1.8%) block_param_proxy_modified: 124,245 ( 1.5%) guard_less_failure: 50,033 ( 0.6%) fixnum_lshift_overflow: 9,985 ( 0.1%) patchpoint_stable_constant_names: 6,342 ( 0.1%) fixnum_mult_overflow: 570 ( 0.0%) obj_to_string_fallback: 405 ( 0.0%) patchpoint_no_ep_escape: 109 ( 0.0%) interrupt: 31 ( 0.0%) guard_super_method_entry: 8 ( 0.0%) guard_greater_eq_failure: 6 ( 0.0%) send_count: 328,805,013 dynamic_send_count: 85,813,616 (26.1%) optimized_send_count: 242,991,397 (73.9%) dynamic_setivar_count: 2,357,065 ( 0.7%) dynamic_getivar_count: 12,322,949 ( 3.7%) dynamic_definedivar_count: 350,548 ( 0.1%) iseq_optimized_send_count: 93,990,621 (28.6%) inline_cfunc_optimized_send_count: 96,851,696 (29.5%) inline_iseq_optimized_send_count: 9,181,467 ( 2.8%) non_variadic_cfunc_optimized_send_count: 25,304,458 ( 7.7%) variadic_cfunc_optimized_send_count: 17,663,155 ( 5.4%) compiled_iseq_count: 2,886 failed_iseq_count: 0 compile_time: 875ms profile_time: 27ms gc_time: 66ms invalidation_time: 9ms vm_write_pc_count: 287,186,308 vm_write_sp_count: 287,186,308 vm_write_locals_count: 274,139,228 vm_write_stack_count: 274,139,228 vm_write_to_parent_iseq_local_count: 1,079,877 vm_read_from_parent_iseq_local_count: 30,810,378 guard_type_count: 310,644,961 guard_type_exit_ratio: 0.6% guard_shape_count: 109,072,242 guard_shape_exit_ratio: 2.3% code_region_bytes: 14,352,384 zjit_alloc_bytes: 19,186,174 total_mem_bytes: 33,538,558 side_exit_count: 8,210,699 total_insn_count: 1,705,193,555 vm_insn_count: 123,691,343 zjit_insn_count: 1,581,502,212 ratio_in_zjit: 92.7% ``` </details>
Also, include the column in here. Hopefully we can do some additional optimizations later. ruby/prism@7759acdd26
In the C API, we want to use slices instead of locations in the AST. In this case a "slice" is effectively the same thing as the location, expect it is represented using a 32-bit offset and a 32-bit length. This will cut down on half of the space of all of the locations in the AST. Note that from the Ruby/Java/JavaScript side, this is effectively an invisible change. This only impacts the C/Rust side.
* Consistent and clear. * Avoids the confusion that "column number" might be understood as a column in an editor starting at 1 (they all start at 0). ruby/prism@91f1c4b9d5
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )