Skip to content

Scheduler Benchmark

Apple-to-apple performance comparison between zerodep scheduler and APScheduler, croniter, and schedule.

Test Environment

  • CPU: x86_64 Linux
  • Python: 3.12
  • Tool: pytest-benchmark 5.2.3 (mean values reported)
  • Reference: APScheduler 3.11.2, schedule 1.2.2, croniter 6.2.2
  • Last Updated: 2026-04-21

Implementations

Implementation File/Package Description
zerodep scheduler.py stdlib-only in-process scheduler
APScheduler (reference) Full-featured job scheduling library
croniter (reference) Cron expression parser and iterator
schedule (reference) Simple in-process scheduling

Performance Comparison (Mean)

Test zerodep croniter APScheduler schedule Speedup
Cron parsing (5 expressions) 43.9 μs -- 182.8 μs N/A 4.2x faster
Next fire time (5 expressions) 53.2 μs -- 132.6 μs N/A 2.5x faster
Batch next fire time (100 iterations) 678.6 μs -- 974.8 μs N/A 1.4x faster
Job add overhead (100 jobs) 530.9 μs N/A N/A 561.5 μs ~same

Key Takeaways

  • Cron parsing is 4.2x faster than APScheduler, thanks to a minimal set-based parser.
  • Next fire time calculation is 2.5x faster, as zerodep uses direct datetime arithmetic without timezone overhead.
  • Batch computation (100 consecutive fire times) maintains the speed advantage at scale (1.4x faster).
  • Job add overhead is comparable to schedule (~same), both adopting a lightweight design.
  • zerodep has zero pip dependencies -- it uses only threading, asyncio, datetime, inspect, and logging from the standard library.

Run It Yourself

pip install pytest pytest-benchmark APScheduler croniter schedule
pytest scheduler/test_scheduler_benchmark.py --benchmark-only -v

Latest CI Results

Updated automatically on each release via Benchmark CI.