Skip to content

time: optimize Parse and Time.Format for RFC3339 #54093

@dsnet

Description

@dsnet

RFC3339 is the most common format to use (according to prior analysis, it accounts for 57% of formats; and that's only explicit calls to Format or Parse. It doesn't cover all the implicit cases that occur through MarshalText and UnmarshalText). We should optimize Parse and Time.Format to do a quick check for the RFC3339Nano or RFC3339 constants and hardcode the logic for that format. This would avoid the double parsing that currently occurs where we parse the format string to functionally run a virtual machine that then parses the input value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions