ruby-changes:20255
From: kosaki <ko1@a...>
Date: Thu, 30 Jun 2011 02:44:05 +0900 (JST)
Subject: [ruby-changes:20255] kosaki:r32303 (trunk): * thread.c (rb_thread_schedule_limits): minor optimization.
kosaki 2011-06-30 02:43:58 +0900 (Thu, 30 Jun 2011) New Revision: 32303 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32303 Log: * thread.c (rb_thread_schedule_limits): minor optimization. eliminate machine context saving when running time is enough small. Modified files: trunk/ChangeLog trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32302) +++ ChangeLog (revision 32303) @@ -1,3 +1,8 @@ +Thu Jun 30 02:41:47 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * thread.c (rb_thread_schedule_limits): minor optimization. + eliminate machine context saving when running time is enough small. + Thu Jun 30 02:28:11 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * thread.c (rb_thread_schedule_rec): move interrupt_flag check to Index: thread.c =================================================================== --- thread.c (revision 32302) +++ thread.c (revision 32303) @@ -1008,15 +1008,13 @@ if (!rb_thread_alone()) { rb_thread_t *th = GET_THREAD(); - thread_debug("rb_thread_schedule/switch start\n"); - - RB_GC_SAVE_MACHINE_CONTEXT(th); - - if (th->running_time_us >= limits_us) + if (th->running_time_us >= limits_us) { + thread_debug("rb_thread_schedule/switch start\n"); + RB_GC_SAVE_MACHINE_CONTEXT(th); gvl_yield(th->vm, th); - - rb_thread_set_current(th); - thread_debug("rb_thread_schedule/switch done\n"); + rb_thread_set_current(th); + thread_debug("rb_thread_schedule/switch done\n"); + } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/