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

More emphasis on extreme values #51

Merged
merged 4 commits into from
Aug 18, 2024
Merged

More emphasis on extreme values #51

merged 4 commits into from
Aug 18, 2024

Conversation

nakedible
Copy link
Owner

@nakedible nakedible commented Aug 17, 2024

Try to make it easier to prove that the algorithms are correct for the entire value range by adding tests in all the algorithms for the extreme values, and also quickcheck the entire range instead of just what is supported by the time library.

In addition to that, with the current RD_MIN and RD_MAX, the wrapping operations were not actually needed. So decided to remove all of them (except wrapping_mul in the one algorithm that actually depends on it). Now if we get a wrap, in debug builds we should get a panic, which is correct for these algorithms.

The values will never actually wrap with the
current set of limits. It's better if we get
notified if the calculations wrap in debug builds.
Copy link
Contributor

Benchmark for 6dcaa83

Click to view benchmark
Test Base PR %
date_to_isoweekdate 10.3±0.08ns 10.3±0.10ns 0.00%
date_to_rd 2.5±0.08ns 2.5±0.04ns 0.00%
date_to_weekday 2.7±0.04ns 2.7±0.03ns 0.00%
datetime_to_secs 5.3±0.09ns 5.3±0.08ns 0.00%
datetime_to_systemtime 9.3±0.10ns 9.3±0.32ns 0.00%
days_in_month 1.4±0.06ns 1.4±0.04ns 0.00%
dhms_to_secs 1.9±0.03ns 1.9±0.03ns 0.00%
is_leap_year 1.3±0.03ns 1.3±0.03ns 0.00%
isoweekdate_to_date 7.4±0.07ns 7.4±0.18ns 0.00%
isoweekdate_to_rd 2.8±0.07ns 2.8±0.18ns 0.00%
isoweeks_in_year 1.9±0.03ns 1.9±0.17ns 0.00%
next_date 1.3±0.11ns 1.3±0.04ns 0.00%
overhead 0.7±0.01ns 0.7±0.01ns 0.00%
prev_date 1.5±0.03ns 1.5±0.03ns 0.00%
rd_to_date 4.0±0.06ns 4.0±0.10ns 0.00%
rd_to_isoweekdate 6.2±0.14ns 6.2±0.13ns 0.00%
rd_to_weekday 0.8±0.02ns 0.8±0.02ns 0.00%
secs_to_datetime 6.8±0.25ns 6.9±0.21ns +1.47%
secs_to_dhms 3.1±0.05ns 3.1±0.06ns 0.00%
secs_to_systemtime 4.1±0.29ns 4.0±0.23ns -2.44%
systemtime_to_datetime 32.7±0.46ns 31.6±0.21ns -3.36%
systemtime_to_secs 17.9±0.34ns 18.7±0.13ns +4.47%

@nakedible nakedible changed the title Comprehensive-tests More emphasis on extreme values Aug 18, 2024
@nakedible nakedible marked this pull request as ready for review August 18, 2024 12:27
@nakedible nakedible merged commit 341d482 into master Aug 18, 2024
2 checks passed
@nakedible nakedible deleted the comprehensive-tests branch August 18, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant