From 5f3189474c3ee3e11b6588acfbb026e119522092 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 2 Jan 2020 11:48:03 -0800 Subject: Avoid rb_check_string_type in month_arg This will usually receive a fixnum so we should check that first instead of the more expensive rb_check_string_type check. --- time.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/time.c b/time.c index fbccc9078d..817b6ef101 100644 --- a/time.c +++ b/time.c @@ -2923,6 +2923,10 @@ month_arg(VALUE arg) { int i, mon; + if (FIXNUM_P(arg)) { + return obj2ubits(arg, 4); + } + VALUE s = rb_check_string_type(arg); if (!NIL_P(s) && RSTRING_LEN(s) > 0) { mon = 0; -- cgit v1.2.3