Comparision
This Comparision is between ChronoX (rust implementation, demonstrate as online API for now) and a popular cargo crate cron that implements the conventional cron.
Each implementation is tested with 3 kinds of expressions of common calendar mode, annotated as simple
, variant
, enum
; as is shown below, expressions of same kind but different implementation are designed to represent same pattern:
Category | ChronoX | cron |
---|---|---|
simple | * * * * * * | * * * * * * |
variant | 1-11/3 */5 * */10 | 0 */10 * */5 1-11/3 ? * |
enum | 1-11/3 1,3,5,10,20 * */10 | 0 */10 * 1,3,5,10,20 1-11/3 ? * |
Calculation time with different # of leaps
Sample Point (# of leaps): 1, 3, 5, 10, 30, 50, 100, 300, 500, 1000, 3000, 5000, 10000
10 leaps means next 10th time from now that follows the pattern
Benchmark with pre-initialized calculation instance and time instance. It shows that ChronoX is competitive when # of leaps are small (around 3) and holds large advantage for increasing # of leaps.
The magnitude may be less important here, since the two implementations use different crate for time representation, which may result in different overhead when convert the calculation result to time representation; However, the growth rate still shows the advantages of ChronoX.
Time for Loading from String
It shows that ChronoX may also be competitve on initializing speed, though it may require some pre-calculation when initialize.