Skip to content

NanoDate significantly (us vs. ns) slower than DateTime #57

@liuyxpp

Description

@liuyxpp

It can be 50x slower. See the following benchmark:

julia> using Dates, NanoDates
julia> using BenchmarkTools: @btime
julia> tstr = "2024-09-23T19:32:06.202111"
julia> @btime NanoDate($tstr)
  3.261 μs (45 allocations: 1.93 KiB)
2024-09-23T19:32:06.202111
julia> tstr23 = tstr[1:23]
julia> @btime DateTime.($tstr23, dateformat"yyyy-mm-ddTHH:MM:SS.sss")
  61.379 ns (0 allocations: 0 bytes)
2024-09-23T19:32:06.202

Anyway to improve it?
It becomes significant when you have a column which millions timestamp string to be converted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions