Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JsonWriter#value(Number) performance #2702

Conversation

Marcono1234
Copy link
Collaborator

Purpose

Improve JsonWriter#value(Number) performance for JDK number types

Description

For JDK number types other than Float and Double there is no need to check if the number string is NaN or Infinity.

This was an oversight when I originally added the validation in #2060.

For JDK number types other than `Float` and `Double` there is no need to
check if the number string is NaN or Infinity.
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good improvement. One very nitpicky comment.

gson/src/main/java/com/google/gson/stream/JsonWriter.java Outdated Show resolved Hide resolved
@eamonnmcmanus eamonnmcmanus merged commit d4d6744 into google:main Jun 18, 2024
11 checks passed
@Marcono1234 Marcono1234 deleted the marcono1234/JsonWriter-value-Number-performance branch June 23, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants