ruby-changes:32206
From: tmm1 <ko1@a...>
Date: Thu, 19 Dec 2013 11:27:40 +0900 (JST)
Subject: [ruby-changes:32206] tmm1:r44285 (trunk): vm_insnhelper.c: optimize for loop
tmm1 2013-12-19 11:27:36 +0900 (Thu, 19 Dec 2013) New Revision: 44285 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44285 Log: vm_insnhelper.c: optimize for loop * vm_insnhelper.c (vm_call_iseq_setup_normal): simple for loop condition optimization. this area shows up as a hotspot in VM profiles. Modified files: trunk/ChangeLog trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44284) +++ ChangeLog (revision 44285) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Dec 19 11:23:49 2013 Aman Gupta <ruby@t...> + + * vm_insnhelper.c (vm_call_iseq_setup_normal): simple for loop + condition optimization. this area shows up as a hotspot in VM + profiles. + Thu Dec 19 10:50:13 2013 Koichi Sasada <ko1@a...> * gc.c (newobj_of): don't need to RBASIC_SET_CLASS() which includes WB Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 44284) +++ vm_insnhelper.c (revision 44285) @@ -1228,13 +1228,13 @@ vm_call_iseq_setup_2(rb_thread_t *th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1228 static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) { - int i; + int i, local_size; VALUE *argv = cfp->sp - ci->argc; rb_iseq_t *iseq = ci->me->def->body.iseq; VALUE *sp = argv + iseq->arg_size; - /* clear local variables */ - for (i = 0; i < iseq->local_size - iseq->arg_size; i++) { + /* clear local variables (arg_size...local_size) */ + for (i = iseq->arg_size, local_size = iseq->local_size; i < local_size; i++) { *sp++ = Qnil; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/