ruby-changes:52490
From: k0kubun <ko1@a...>
Date: Wed, 12 Sep 2018 22:32:22 +0900 (JST)
Subject: [ruby-changes:52490] k0kubun:r64699 (trunk): _mjit_compile_pc_and_sp.erb: forget about memcpy [ci skip]
k0kubun 2018-09-12 22:32:11 +0900 (Wed, 12 Sep 2018) New Revision: 64699 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64699 Log: _mjit_compile_pc_and_sp.erb: forget about memcpy [ci skip] because using memcpy here actually made performance worse. In Optcarrot, * for loop fps: 55.90428960597268 fps: 57.21690379342434 fps: 58.41751168279789 fps: 58.7317470613203 fps: 62.81371000202459 fps: 63.02541045417479 fps: 63.77324026366317 fps: 65.48067818347447 fps: 66.02324323831398 fps: 66.3816048847424 fps: 66.54526488660156 * memcpy fps: 54.98389812126847 fps: 57.96524857391357 fps: 57.974918725327946 fps: 58.285987089087364 fps: 58.639003211333225 fps: 59.03244214601948 fps: 59.89964772199603 fps: 60.809490242786175 fps: 62.462070790624146 fps: 62.534599002918306 fps: 63.787312566163756 That's probably because the copied size is very small. Modified files: trunk/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb Index: tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb (revision 64698) +++ tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb (revision 64699) @@ -21,7 +21,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb#L21 rb_snum_t i, push_size; push_size = -<%= insn.call_attribute('sp_inc') %> + <%= insn.rets.size %> - <%= insn.pops.size %>; fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */ - for (i = 0; i < push_size; i++) { /* TODO: use memcpy? */ + for (i = 0; i < push_size; i++) { fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/