Skip to content

Cldr.Number.to_string performs expensive validate_options #63

@tomtaylor

Description

@tomtaylor

I've been tracing a hot path in our app, and found a surprisingly expensive call to Cldr.Number.to_string. A call to this is dominated by Cldr.Number.Format.Options:validate_options/3, specifically, a call to [Backend].Cldr.Number:default_options/0 calling Cldr:get_locale/1 in turn. I've attached a flame graph you can open in https://www.speedscope.app/

1774277542281657-eflambe-output.bggg.zip

I think this could be solved by lazily evaluating the default options on a per-key basis. Do you have any particular preference about how to approach this?

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