-
-
Notifications
You must be signed in to change notification settings - Fork 747
Optimized std.datetime.date.Date.fromISOExtString #6062
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
Conversation
|
Thanks for your pull request, @JackStouffer! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
wilzbach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To save other reviewers time looking. to (or to be exact the underlying parse) does error checking itself, see
ac9ff8c to
b86a7f9
Compare
| auto signAtBegining = yearStr.startsWith('-', '+'); | ||
| if ((yearStr.length > 4 && !signAtBegining) || | ||
| (yearStr.length <= 4 && signAtBegining)) | ||
| throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate to nitpick style, but would you please use braces if the condition is more than one line - either that or put the condition on a single line instead of breaking it up. IMHO, it's a readability problem if there are no braces when the condition is multiple lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, aside from the optimizer being smart about things here (which it may be), I would expect it to be faster if you broke this up so that it didn't check the length twice given that it's the same check in reverse.
b86a7f9 to
55223b3
Compare
55223b3 to
54708e1
Compare
Removed explicit auto-decoding and simplified/speed up format checking.
Previous PRs: #5550 #5404 #5413
Results:
Code