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

Appearance settings

Enhancement: Improve toString performance #863

Copy link
Copy link
@Simulant87

Description

@Simulant87
Issue body actions

The toString methods of JSONObject and JSONArray are not very fast, mostly because of the usage of StringWriter and the generic code to support an indent, although in the default toString case it is always 0.

You can compare the performance of the library e.g. with this comparison project, which also list the results in a graph:
https://github.com/fabienrenaud/java-json-benchmark?tab=readme-ov-file#users-model

My suggestion is to improve the performance for the default toString method without indent by duplicating by using a StringBuilder instead of a StringWriter.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.