Speed of Calculation
This benchmark is tested with a rust implementation of ChronoX (demonstraste as online API for now), each calendar mode has 3 kinds of expressions, expressions of same kind are kept similar as show below:
Mode | Simple | Variant | Enum |
---|---|---|---|
Day of Year | * * * | 10-L5/3 */5 * */10 | 10-L5/3 1,3,5,10,20 * */10 |
Week of Month | * * * * * | 1-L1/3 * */1 * */10 | 1-L1/3 * 0,1,3,5,6 * */10 |
Common | * * * * | 10-L5/3 */5 * */10 | 10-L5/3 1,3,5,10,20 * */10 |
Week of Year | * * * * | 10-L5/3 */5 * */10 | 10-L5/3 1,3,4,5,6 * */10 |
Sample Point (# of leaps): 1, 3, 5, 10, 50, 100, 300, 500, 1000, 5000, 10000
10 leaps means next 10th time from now that follows the pattern
It shows the time complexity is between constant and log.
note
Time complexity for worst case (pattern like * 1 0 0 0
) may reduce to linear time; however ChonoX still holds advantage since optimizations can be applied to reduce overhead and number of loops needed; Besides, in general there are not many years to loop with;