Skip to content

Date and DateTime parsing slower than 1.7 and much slower than MRI #3640

@mjc

Description

@mjc
string = "2016-02-03T17:44:04Z"

Benchmark.ips do |x|
  x.config warmup: 90 if RUBY_PLATFORM == 'java'
  x.report("Date#parse") { Date.parse(string) }
  x.report("DateTime#parse") { DateTime.parse(string) }
end

1.7.23:

          Date#parse     23.823k (± 4.3%) i/s -    119.444k
      DateTime#parse     17.959k (±10.8%) i/s -     89.750k

9.0.5.0:

          Date#parse     14.201k (±11.8%) i/s -     70.884k
      DateTime#parse     11.330k (±10.1%) i/s -     57.246k

MRI 2.3.0

          Date#parse     61.387k (± 4.6%) i/s -    308.966k
      DateTime#parse     60.220k (± 6.5%) i/s -    301.658k

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions