-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
JRuby 9.2 moved most of date.rb into native, a lot of date/format.rb pieces are left.
these have been cleaned up with some parts moved into .java as well (in MRI its all C since 2.x)
still performance is worse than MRIs :
Rehearsal ---------------------------------------------------------------------------------------------------------
Date._strptime('2001-02-03', '%Y-%m-%d') [3000000x] 2.850000 0.130000 2.980000 ( 1.585740)
Date._strptime('2017-05-20 18:20:10', '%Y-%m-%d %H:%M:%S') [3000000x] 2.520000 0.010000 2.530000 ( 1.888403)
Date.parse('2018-07-17', false) [3000000x] 60.960000 0.080000 61.040000 ( 57.224618)
Date._parse('2018-07-17 21:20:55') [3000000x] 76.980000 0.110000 77.090000 ( 73.975601)
Date.iso8601('1999-12-31T00:00:00') [3000000x] 12.860000 0.040000 12.900000 ( 11.075091)
DateTime.iso8601('1999-12-31T19:20:06') [3000000x] 39.950000 0.080000 40.030000 ( 34.704867)
---------------------------------------------------------------------------------------------- total: 196.570000sec
user system total real
Date._strptime('2001-02-03', '%Y-%m-%d') [3000000x] 1.290000 0.000000 1.290000 ( 1.220147)
Date._strptime('2017-05-20 18:20:10', '%Y-%m-%d %H:%M:%S') [3000000x] 1.780000 0.000000 1.780000 ( 1.689286)
Date.parse('2018-07-17', false) [3000000x] 56.580000 0.060000 56.640000 ( 55.751624)
Date._parse('2018-07-17 21:20:55') [3000000x] 74.200000 0.190000 74.390000 ( 72.432050)
Date.iso8601('1999-12-31T00:00:00') [3000000x] 10.870000 0.020000 10.890000 ( 10.519134)
DateTime.iso8601('1999-12-31T19:20:06') [3000000x] 34.040000 0.060000 34.100000 ( 33.126543)
MRI 2.5 :
user system total real
Date._strptime('2001-02-03', '%Y-%m-%d') [3000000x] 2.099370 0.000000 2.099370 ( 2.099385)
Date._strptime('2017-05-20 18:20:10', '%Y-%m-%d %H:%M:%S') [3000000x] 3.028066 0.000000 3.028066 ( 3.028100)
Date.parse('2018-07-17', false) [3000000x] 12.222756 0.000000 12.222756 ( 12.222796)
Date._parse('2018-07-17 21:20:55') [3000000x] 29.789987 0.000000 29.789987 ( 29.790399)
Date.iso8601('1999-12-31T00:00:00') [3000000x] 9.213094 0.000000 9.213094 ( 9.213815)
DateTime.iso8601('1999-12-31T19:20:06') [3000000x] 9.899020 0.000000 9.899020 ( 9.899302)
... since some pieces are 3-4x slower this might be worth investigating.
code for benchmark was chosen based on patterns/methods used in Rails
NOTE: haven't looked into those, but there's a lot of 'crazy' regexp matching, maybe MRI avoids some of those. as I did some C porting I noticed the format.rb parts are no longer an exact match to MRI's date.c
Reactions are currently unavailable