diff options
author | Stanislav Mayorov <[email protected]> | 2019-01-31 16:02:40 +0700 |
---|---|---|
committer | Stanislav Mayorov <[email protected]> | 2019-01-31 16:16:39 +0700 |
commit | 27ccbe9779ddab2402a44d1a9639620ee704f634 (patch) | |
tree | 29e3a902956cb19d77e203403af34733404db3a9 /lib/kernel/doc/src/disk_log.xml | |
parent | 3825199794da28d79b21052a2e69e2335921d55e (diff) | |
download | otp-27ccbe9779ddab2402a44d1a9639620ee704f634.tar.gz otp-27ccbe9779ddab2402a44d1a9639620ee704f634.tar.bz2 otp-27ccbe9779ddab2402a44d1a9639620ee704f634.zip |
Optimize calendar:gregorian_days_to_date/1
This patch improves the performance of calendar:gregorian_days_to_date/1
by changing the algorithm for finding the year to log-logarithmic.
The old implementation has linear complexity, which makes function
too slow for large values.
For example:
There is an API that allows you to create events for future dates.
There are users of this API who, for some reasons, choose dates
very far in the future. In such conditions, function works very slow.
New implementation based on interpolation search, takes 1 or 2
iterations at most cases and free from such a flaw.
A unit test was also developed to illustrate the speed of a function
at large values.
Diffstat (limited to 'lib/kernel/doc/src/disk_log.xml')
0 files changed, 0 insertions, 0 deletions