ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:104552] [Ruby master Feature#18033] Time.new to parse a string
@ 2021-07-09  6:13 nobu
  2021-07-09  6:30 ` [ruby-core:104554] " samuel
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: nobu @ 2021-07-09  6:13 UTC (permalink / raw)
  To: ruby-core

Issue #18033 has been reported by nobu (Nobuyoshi Nakada).

----------------------------------------
Feature #18033: Time.new to parse a string
https://bugs.ruby-lang.org/issues/18033

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
----------------------------------------
Make `Time.new` parse `Time#inspect` and ISO-8601 like strings.

* `Time.iso8601` and `Time.parse` need an extension library, `date`.
* `Time.iso8601` can't parse `Time#inspect` string.
* `Time.parse` often results in unintentional/surprising results.
* `Time.new` also about 1.9 times faster than `Time.iso8601`.

    ```
    $ ./ruby -rtime -rbenchmark -e '
    n = 1000
    s = Time.now.iso8601
    Benchmark.bm(12) do |x|
      x.report("Time.iso8601") {n.times{Time.iso8601(s)}}
      x.report("Time.parse") {n.times{Time.parse(s)}}
      x.report("Time.new") {n.times{Time.new(s)}}
    end'
                       user     system      total        real
    Time.iso8601   0.006919   0.000185   0.007104 (  0.007091)
    Time.parse     0.018338   0.000207   0.018545 (  0.018590)
    Time.new       0.003671   0.000069   0.003740 (  0.003741)
    ```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2022-12-15  6:54 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09  6:13 [ruby-core:104552] [Ruby master Feature#18033] Time.new to parse a string nobu
2021-07-09  6:30 ` [ruby-core:104554] " samuel
2021-07-09  7:51 ` [ruby-core:104559] " nobu
2021-07-09  8:29 ` [ruby-core:104562] " samuel
2021-07-09  8:51 ` [ruby-core:104564] " nobu
2021-07-10  8:42 ` [ruby-core:104575] " jean.boussier
2021-07-16  2:48 ` [ruby-core:104626] " samuel
2021-10-24 23:14 ` [ruby-core:105763] " ioquatix (Samuel Williams)
2021-11-10 10:44 ` [ruby-core:106002] " Eregon (Benoit Daloze)
2021-11-10 11:26 ` [ruby-core:106007] " byroot (Jean Boussier)
2021-11-12 11:33 ` [ruby-core:106036] " timcraft (Tim Craft)
2021-12-03  4:07 ` [ruby-core:106440] " nobu (Nobuyoshi Nakada)
2021-12-03  6:54 ` [ruby-core:106443] " nobu (Nobuyoshi Nakada)
2021-12-03 10:08 ` [ruby-core:106449] " sawa (Tsuyoshi Sawada)
2021-12-03 10:23 ` [ruby-core:106451] " sawa (Tsuyoshi Sawada)
2021-12-03 11:33 ` [ruby-core:106452] " Eregon (Benoit Daloze)
2021-12-03 13:21 ` [ruby-core:106456] " nobu (Nobuyoshi Nakada)
2021-12-03 13:49 ` [ruby-core:106458] " nobu (Nobuyoshi Nakada)
2021-12-06  4:55 ` [ruby-core:106501] " nobu (Nobuyoshi Nakada)
2021-12-06 13:18 ` [ruby-core:106512] " Eregon (Benoit Daloze)
2021-12-06 14:54 ` [ruby-core:106516] " nobu (Nobuyoshi Nakada)
2021-12-06 17:37 ` [ruby-core:106521] " Eregon (Benoit Daloze)
2021-12-07 14:15 ` [ruby-core:106537] " nobu (Nobuyoshi Nakada)
2022-12-15  6:11 ` [ruby-core:111293] " mame (Yusuke Endoh)
2022-12-15  6:54 ` [ruby-core:111295] " matz (Yukihiro Matsumoto)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).