TKS Ephemeris · developer · performance
A reproducible benchmark of the TKS Ephemeris (JPL DE440) against the official Swiss Ephemeris C library, and an end-to-end profile of the Jyotiṣa page. Every figure below is reproducible from §5; measurements are best-of-three full runs on the machine in §1.
| CPU | Apple M3 Max — 14 cores (10 performance + 4 efficiency) |
|---|---|
| Memory | 36 GB unified · Model Mac15,10 |
| OS | macOS 26.6.2 (Darwin 25.6.0, arm64 / T6031) |
| Toolchain | rustc 1.98.0 · --release |
| TKS engine | JPL DE440 (Chebyshev) · true Chitrāpakṣa |
| Swiss Ephemeris | pyswisseph 2.10.03 · real .se1 files (1800–2400), file mode (verified via returned flags, not the Moshier fallback) |
Bodies: Sun · Moon · Mercury · Venus · Mars · Jupiter · Saturn · Uranus · Neptune · Pluto · True-Node. Geocentric apparent tropical longitude, 1-day spacing.
| Engine | Total (best-of-3) | per 11-body set | per position | vs Swiss |
|---|---|---|---|---|
| TKS Ephemeris (DE440) | 0.169 s | 0.0154 ms | 1.54 µs | 1.31× faster |
| Swiss Ephemeris 2.10.03 (files) | 0.222 s | 0.0202 ms | 2.02 µs | 1.00× |
| TKS per-call API¹ | 0.267 s | 0.0243 ms | 2.43 µs | 1.20× slower |
| Swiss (Moshier fallback) | 1.260 s | 0.1146 ms | 11.45 µs | — |
apparent_direction() fetches the Earth state per call; the production pipeline shares Earth/Sun per epoch and uses two light-time iterations — the TKS Ephemeris row. Target check: both engines deliver 10,000 × 11 positions well under 3 s. Correctness: true Rāhu = Gemini 10.78° in both (agree < 0.01°).The /tks-jyotish page issues 25 parallel computations (vara · chalit · 16 vargas · upagraha · Vimśottarī 3 levels · ṣaḍbala · aṣṭakavarga · maitrī · jaimini · doṣa · rāja/nābhasa-yoga · chara/nārāyaṇa/sudarśana dāśās · yoga-samuh · aṣṭottarī · gochara · kālacakra). Measured over 1,000 page loads (all 25 issued concurrently per load).
| Metric | min | p50 | p90 | p99 | max | mean | throughput |
|---|---|---|---|---|---|---|---|
| Full page (25 endpoints) | 10.65 ms | 12.45 ms | 13.35 | 17.21 | 24.65 | 12.59 ms | 79.4 /s |
| endpoint | req/s | time/req (concurrent) | failed |
|---|---|---|---|
sudarśana (ab -n 1000 -c 10) | 1,646 | 0.607 ms | 0 |
| maitrī | 2,364 | 0.423 ms | 0 |
# 1. Ephemeris, 10,000 x 11 (TKS) cargo build --release --example bench_11 -p tks-ephemeris ./target/release/examples/bench_11 # 2. Swiss Ephemeris (real .se1 files), same 10,000 x 11 TKS_SWISS_EPHE=/path/to/ephe /tmp/swevenv/bin/python scripts/bench_swiss.py # 3. Full jyotisa page (25 endpoints, 1000 loads) + concurrency ./target/release/panchanga --serve --port 8099 & python3 scripts/bench_page.py ab -n 1000 -c 10 "http://127.0.0.1:8099/v1/vedic/sudarshana?engine=tks&date=2001-08-27&time=06:15&place=Dehradun&lat=30.3165&lon=78.0322&tz=5.5"
Connection: close); ephemeris rows measure pure computation.