-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New TIME functions #2
Conversation
Thank you for your PR. I won't merge it due to the following reasons:
|
I would not agree
Smaller functions always have benefit. They can be used when you do not need complex sets of data and only need one parameter. Yet it simplify other functions hugely. You could see that I refactored your most complex function to just this.
How is this not beneficial?
Working with dates as a string is always more preferable way. This way there are not mathematical calculations. We only change representation of bytes in memory. No manipulation with that data. If you think it is not faster then input variable may be already date string, so you can convert it once and then use it though program. At the end it will be much faster anyway.
I can change it to date_to_duint. But I though it is standard conversion function.
That I can also add as enum and anyway if you works with week you have to give option to user to set first day of week. That does not affect anything else except day of week and week of year. That is it. the rest does not change. But if you want I can reset it to Monday first week day without ability to change |
That would be true if the parameters are independent - in this case, they are not (the same principle as in math utility's statistic functions).
I disagree. Date is internally stored as days since 1992-01-01. When you invoke the
I disagree as well: Discussions about speed are futile. Just implement it, run it a million times, measure required duration and compare the results. Maybe there are some optimizations done by the compiler or runtime in your environment which speeds your code up. In my environment, your code is significant slower than mine.
In fact, in my environment (Siemens) there are no Finally, I won't accept your PR now. Please, don't be disappointed about my decision. Either way, thank you for your participation! |
After our discussion I've refactored the TIME utility (see commit 0f49e67 for details). In fact, the calculations of day of week, day of year and week of year can be implemented independent; and the DATE_PARTS struct was overloaded with these values. Thank you for your participation and your pointing to some disadvantages of my solution! |
Why 2 functions internal and not internal? |
Due to the following reasons:
|
I ma planning to make some modifications to core functions. But for that I need helper functions. This PR I only send you those additional functions without changing your core functions. Then I'll send new PR for each core function modification. I plan significantly simplify TIME related functions.
SO if you accept this PR, I'll take it as "Yes continue please!"