Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add fast path to json string encoding #135336

Closed
Labels
extension-modulesC modules in the Modules dirperformancePerformance or resource usagetype-featureA feature request or enhancement
@nineteendo

Description

@nineteendo

Feature or enhancement

Proposal:

Most JSON strings consist solely of ASCII characters that don’t require escaping, so adding a fast path for those would make a big difference. In these cases, we can avoid allocating a new string by writing the original string directly:

PyUnicodeWriter_WriteChar(writer,'"')PyUnicodeWriter_WriteStr(writer,pystr)// original stringPyUnicodeWriter_WriteChar(writer,'"')

Benchmarks have shown that this roughly 2.2x faster, see PR.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirperformancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp