Skip to content

json_decode allocates a String for every JSON number #207

Description

@timfennis

Since #199, json_to_value converts every JSON number via n.to_string() plus a char scan, allocating a String per number even for plain integers. Before #199 common integers decoded allocation-free via as_i64().

Suggested direction

Try n.as_i64() first (this works under arbitrary_precision) and fall back to the string representation only for floats and integers that overflow i64.

🤖

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions