ruby-changes:53146
From: nobu <ko1@a...>
Date: Thu, 25 Oct 2018 09:36:31 +0900 (JST)
Subject: [ruby-changes:53146] nobu:r65360 (trunk): time.c: benchmark recovery
nobu 2018-10-25 09:36:23 +0900 (Thu, 25 Oct 2018) New Revision: 65360 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65360 Log: time.c: benchmark recovery * time.c (time_localtime): check if `vtm.zone` is a simple zone name string before trying to call the conversion method. since r64952, `Time.getlocal` on UTC time has lost the performance about 45%, due to this call. the performance is about 90% of r64951 by avoiding it. Modified files: trunk/time.c Index: time.c =================================================================== --- time.c (revision 65359) +++ time.c (revision 65360) @@ -3623,6 +3623,7 @@ time_localtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3623 { struct time_object *tobj; struct vtm vtm; + VALUE zone; GetTimeval(time, tobj); if (TZMODE_LOCALTIME_P(tobj)) { @@ -3633,7 +3634,8 @@ time_localtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3634 time_modify(time); } - if (!NIL_P(tobj->vtm.zone) && zone_localtime(tobj->vtm.zone, time)) { + zone = tobj->vtm.zone; + if (maybe_tzobj_p(zone) && zone_localtime(zone, time)) { return time; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/