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

JSON parsing optimizations #364

Merged
merged 6 commits into from
Feb 14, 2023
Merged

JSON parsing optimizations #364

merged 6 commits into from
Feb 14, 2023

Conversation

Katsute
Copy link
Member

@Katsute Katsute commented Feb 12, 2023

Prerequisites

Issues must meet the following criteria:

  • No similar pull request exists.
  • Code follows the general code style of this project.
  • No sensitive information is exposed.
  • Relevant comments have been added.

GitHub Copilot Disclaimer

The use of GitHub Copilot is strictly prohibited on this repository.

  • This pull does not use GitHub Copilot.

Changes Made

List any changes made and/or other relevant issues.

WF-4168613316

Release Notes

This library is now 70% faster after this change.

@Katsute Katsute self-assigned this Feb 12, 2023

for(int i = start + 1; i < end; i++){
final char ch = json.charAt(i);
switch(E){

Check warning

Code scanning / CodeQL

Missing enum case in switch

Switch statement does not have a case for [END_OF_KEY](1). Switch statement does not have a case for [KEY](2). Switch statement does not have a case for [START_OF_KEY](3).
throw new JsonSyntaxException("Unexpected array value syntax: '" + ln + '\'', json);
continue;
case LITERAL: // expecting literal value
switch(T){

Check warning

Code scanning / CodeQL

Missing enum case in switch

Switch statement does not have a case for [UNKNOWN](1).
throw new JsonSyntaxException("Unexpected object value syntax: '" + ln + '\'', json);
continue;
case LITERAL: // expecting literal value
switch(T){

Check warning

Code scanning / CodeQL

Missing enum case in switch

Switch statement does not have a case for [UNKNOWN](1).
case ',': // next in object
case '}': // end of object
E = START_OF_KEY; // prepare for next
switch(T){ // push value

Check warning

Code scanning / CodeQL

Missing enum case in switch

Switch statement does not have a case for [UNKNOWN](1).
try{
list.add(Integer.parseInt(V));
}catch(final NumberFormatException ignored){
list.add(Long.parseLong(V));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
try{
list.add(Double.parseDouble(V));
}catch(final NumberFormatException ignored){
list.add(Long.parseLong(V));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
try{
obj.set(K, Integer.parseInt(V));
}catch(final NumberFormatException ignored){
obj.set(K, Long.parseLong(V));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
try{
obj.set(K, Double.parseDouble(V));
}catch(final NumberFormatException ignored){
obj.set(K, Long.parseLong(V));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
@Katsute Katsute marked this pull request as ready for review February 12, 2023 17:59
@Katsute

This comment has been minimized.

@ghost

This comment has been minimized.

@Katsute

This comment has been minimized.

@ghost

This comment has been minimized.

@Katsute

This comment has been minimized.

ghost
ghost previously approved these changes Feb 13, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

@Katsute I have approved this pull request

@Katsute

This comment has been minimized.

@ghost

This comment has been minimized.

@Katsute

This comment has been minimized.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

@Katsute I have approved this pull request

@Katsute Katsute merged commit 4d26ace into main Feb 14, 2023
@Katsute Katsute deleted the json-optimization@b6517ca branch February 14, 2023 01:47
@ghost ghost locked and limited conversation to collaborators Feb 14, 2023
@Katsute Katsute changed the title JSON optimizations JSON parsing optimizations Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant