-
-
Notifications
You must be signed in to change notification settings - Fork 20
JsonConvert Numberic parser update #415
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
base: main
Are you sure you want to change the base?
Conversation
* numeric parser updated
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thanks! Can you also then either adjust the unit tests and/or add new ones to cover your findings? |
Description
I noticed a lot of Deserialize exceptions diring parsing of JSON containing values "on the edge". Proposed changes alows avoid unnecessary exceptions.
Algorithm assumes that numbers which has length of their string representation 9 characters or less are probably 32-bit ints and 12 characters or longer are 64 bit ints. Updated routine utilizes .TryParse methods.
Motivation and Context
This change is only proposal, which benefit is cleaner code.
How Has This Been Tested?
Benchmarks and tests has been executed over updated code. Tests were green and benchmarks show no performance degradation.
Test environment:
Viisual studio 2022 v17.14.0 Preview 2.0
Generic ESP32S3 N16R8 board for benchmarks
Screenshots
Types of changes
Checklist:
Attached files are:
benchmarks_before_refactoring.txt
benchmarks_after_refactoring.txt
Test JSON content: test.json
Exception shown during deserialization: exception.txt