Skip to content

json: Speed up json.dump() with non-default options. #158270

Description

@methane

Feature or enhancement

Proposal:

By making json.dump() skip creating a JSONEncoder instance and calling its encode() method, and instead invoke the internal encoding logic directly, we can reduce the time required to encode small JSON objects by about 20% with the default options and about 50% with non-default options.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

faster-cpython/ideas#742

Linked PRs

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

    performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions