From: Eric Wong Date: 2015-12-08T08:18:35+00:00 Subject: [ruby-core:71941] Re: [Ruby trunk - Feature #11786] [Open] [PATCH] micro-optimize case dispatch even harder SASADA Koichi wrote: > On 2015/12/08 13:53, Eric Wong wrote: > >> > how to mark literal objects? > > Take ideas from nobu (r52708 :) > > I meant marking, not for freeing a table. Oops :x I added rb_mark_set to the Data_Wrap_Struct calls http://80x24.org/spew/20151208080840.24265-1-e@80x24.org/raw benchmark results: minimum results in each 10 measurements. Execution time (sec) name a b loop_whileloop2 0.104 0.104 vm2_case* 0.072 0.062 vm2_case_lit* 0.540 0.539 vm2_case_small* 0.060 0.053 Speedup ratio: compare with the result of `a' (greater is better) name b loop_whileloop2 0.994 vm2_case* 1.153 vm2_case_lit* 1.002 vm2_case_small* 1.136 > I'm not sure it is worth or not. IMO keeping simple with Hash is better > on this case with your measured improvements. Yeah, it's pretty minor. I'm not even sure if opt_case_dispatch makes any difference at all for most real code. st_table still has a lot of space overhead and id_table is not usable here.