-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Use standard library to compare bytes in parseDateTime
#1234
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
CI reports a unit test case fail, but seems nothing so serious.
|
@shogo82148 |
Why? |
@methane So, I would like to remove the global pre-allocated
|
d38133c
to
68340de
Compare
time.Time
in function parseDateTime
parseDateTime
@methane |
switch len(b) { | ||
case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM" | ||
if string(b) == base[:len(b)] { | ||
if bytes.Equal(b, zeroDateTime[:len(b)]) { |
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.
Why?
Do you expect performance improvement? or readability improvement?
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.
Both actually. No need for a constant variable base
here.
Description
Use a pre-allocatedtime.Time
in functionparseDateTime
.base
.Checklist