10x faster than Spark on a laptop
Krishiv 0.2: 10x faster than Spark on a laptop
On one laptop, with the same Parquet files, Krishiv 0.2 ran 22 queries derived from TPC-H at scale factor 100 (SF100, about 100 GB of data) 10.4 times faster than Apache Spark 4.2.0, measured as a geometric mean of per-query time.
At SF1000 (about 1 TB) it completed all 22 queries inside a 20 GB memory limit. It is not the fastest engine on this workload: an embedded reference engine, named on the benchmarks page, is still faster today.
Krishiv 0.2 is a first release, and these numbers describe one machine on one workload.
Key facts
| Fact | Value | Method and version |
|---|---|---|
| Speed-up over Spark | 10.4x geometric mean | 22 queries derived from TPC-H, SF100, cold, two runs per query; Krishiv 0.2 (commit f345c5e) against Spark 4.2.0 |
| Total time, SF100 | Krishiv 228 s, Spark 2,675 s | all 22 queries; Spark with 12 shuffle partitions took 3,137 s |
| SF1000 | Krishiv completed 22 of 22 | 20 GB engine memory limit, spilling to disk; the slowest (Q18) took 654 s. Spark (20 GB driver, 28 GB container) was run on Q01 to Q17 only: 6 finished inside the cap of 30 minutes per run, 11 did not; Q18 to Q22 were not run |
| Against the reference engine | Krishiv is slower: 1.18x, 1.19x and 1.26x its time | geometric mean at SF10, SF100 and SF1000 (SF1000 over 21 queries, and its Q01 time is from an earlier run in which the reference engine had a 40 GB cap) |
| Correctness | Results match the reference engine | full rows compared once; timed runs then checked by row count and checksum (row count only where a LIMIT can cut a tie: five queries at SF100 and four at SF1000): 22 of 22 at SF10 and SF100; 20 of 22 at SF1000, see the limits below. Spark's answers were not verified |
| Machine | One laptop | i7-9750H, 12 threads, 64 GB RAM, NVMe SSD, Linux, powersave CPU governor |
| Not | An audited TPC-H result | derived from TPC-H; see the notice below |
How fast is Krishiv 0.2 compared with Spark?
The benchmarks page has every number and its method. The short version, at SF100:
- Geometric mean: 10.4x faster than Spark 4.2.0 (the gate build, commit f345c5e).
- Total for all 22 queries: 228 seconds against 2,675 seconds.
- Per query: Krishiv was faster than Spark on every query, from 5.0x on Q19 to 28.0x on Q01 (Q01 took 10.6 s against 298 s).
The table below is the same gate run, so its times add up to the total above. Krishiv 0.2 (the gate build, commit f345c5e) against Spark 4.2.0, 22 queries derived from TPC-H, SF100, cold runs:
| Query | Krishiv 0.2 | Spark 4.2.0 | Spark / Krishiv |
|---|---|---|---|
| Q01 | 10.6 s | 298 s | 28.0x |
| Q02 | 2.2 s | 34 s | 15.6x |
| Q03 | 10.4 s | 110 s | 10.6x |
| Q04 | 6.2 s | 80 s | 12.9x |
| Q05 | 12.6 s | 194 s | 15.5x |
| Q06 | 4.2 s | 31 s | 7.4x |
| Q07 | 11.1 s | 89 s | 8.0x |
| Q08 | 13.6 s | 139 s | 10.3x |
| Q09 | 24.3 s | 262 s | 10.8x |
| Q10 | 12.6 s | 81 s | 6.4x |
| Q11 | 2.1 s | 33 s | 15.7x |
| Q12 | 5.8 s | 55 s | 9.5x |
| Q13 | 10.7 s | 74 s | 6.9x |
| Q14 | 7.7 s | 39 s | 5.0x |
| Q15 | 13.2 s | 76 s | 5.7x |
| Q16 | 3.4 s | 50 s | 14.9x |
| Q17 | 11.7 s | 296 s | 25.2x |
| Q18 | 21.5 s | 281 s | 13.1x |
| Q19 | 7.8 s | 39 s | 5.0x |
| Q20 | 9.6 s | 50 s | 5.2x |
| Q21 | 24.6 s | 340 s | 13.8x |
| Q22 | 2.1 s | 24 s | 11.6x |
Spark was run in local[*] mode over Spark Connect, with a 20 GB driver and spark.sql.shuffle.partitions=24 and Spark 4 defaults otherwise. A run with 12 shuffle partitions was slower (3,137 s). Spark's times include the Spark Connect round trip.
What happens at SF1000, a terabyte of data?
At 1 TB the question is whether the engine finishes. Krishiv completed all 22 queries inside its 20 GB memory limit by spilling to disk; the slowest, Q18, took 654 seconds.
Spark (20 GB driver, in a 28 GB container) was run on Q01 to Q17 only: 6 of those finished inside the cap of 30 minutes per run (Q02, Q06, Q11, Q12, Q13 and Q14) and 11 did not. Q18 to Q22 were not run.
With the same limit the reference engine was killed for memory on Q01 and Q18. Its Q01 time is from an earlier run with a 40 GB cap, where it used 35 GB; it has no Q18 time. Krishiv's Q01 and Q18 were then timed alone, outside the 28 GB container.
Peak resident memory can exceed the engine limit: in the capped runs Krishiv peaked at 23.5 GiB (Q09) and the reference engine at 22.0 GiB (Q21), both inside the 28 GB container.
How was it measured?
| Item | Setting |
|---|---|
| Machine | One laptop: i7-9750H, 12 threads, 64 GB RAM, NVMe SSD, Linux, powersave CPU governor |
| Data | Derived from TPC-H, not audited: Parquet generated with tpchgen 3.0.0 (not dbgen) at SF10, SF100 and SF1000, read in place with no loading step |
| Runs | Cold: the dataset is evicted from the OS page cache before every run; two cold runs per query, one after the other, one engine at a time (not interleaved) |
| Limits | 12 threads and a 20 GB engine memory limit for Krishiv and the reference engine, inside a 28 GB cgroup; Spark driver memory 20g |
| Versions | Krishiv 0.2 (commit f345c5e); Apache Spark 4.2.0, local[*] over Spark Connect, spark.sql.shuffle.partitions=24 ; the reference engine at its 2.0.0 release |
| Correctness | Krishiv's results match the reference engine's on the same data (full rows compared once, then row count and checksum; see the limits) |
How do I reproduce the benchmark?
The harness and the engine configurations are in the repository. Your numbers will differ with your CPU, disk and memory; the ratio between engines on the same machine is the part to compare.
If yours does not match, tell us on GitHub with the machine and the command.
What are the limits of these results?
- First release. Krishiv 0.2 is the first release. The API is not stable before 1.0, and streaming, incrementally maintained views, Spark Connect and distributed execution are not part of it.
- A reference engine is still faster. Krishiv's geometric-mean time is 1.18x, 1.19x and 1.26x that engine's at SF10, SF100 and SF1000. Per query at SF1000 it ranges from 0.59x on Q03 (Krishiv faster) to 2.61x on Q16 (Krishiv slower). That is the claim for one node: faster than Spark, behind the fastest embedded engine.
- One machine, runs on different days. Two cold runs per query on one laptop, one engine after another: Spark's runs are from 10 November and Krishiv 0.2's from 12 and 13 November. Spark was not rerun for the release build. Spark on a cluster, or on a different node, will give a different ratio.
- Correctness is checked against the reference engine, not against the official answer set. At SF1000, 20 of the 22 results matched a fresh run of the reference engine and Q01 matched an earlier one. Q18 is consistent across repeated Krishiv runs only, because the reference engine could not finish it within the limit. Spark's answers were not verified.
- Q11 returns no rows at SF100 and SF1000. The query's filter fraction is not scaled by 1/SF, so at these scales both engines return an empty result; its time is still in the totals.
- Not the audited benchmark. These queries are derived from the TPC-H benchmark. These are not TPC-H results: they are unaudited, and not comparable with published TPC results. TPC-H is a trademark of the Transaction Processing Performance Council.
- One machine, batch only. The distributed, lakehouse and streaming benchmarks on the benchmarks page are marked as not yet run.
Where do I find out what Krishiv 0.2 ships?
This post is about the benchmark only. Introducing Krishiv 0.2 lists what ships and what does not, and the Spark alternative in Rust page says who Krishiv is for.
To try it: pip install "krishiv[pyarrow]", then follow the quickstart.
Apache Spark and Spark are trademarks of the Apache Software Foundation. Krishiv is not affiliated with or endorsed by the Apache Software Foundation.
Enjoyed this post? Star Krishiv on GitHub to follow along.
Star on GitHub
Comments
No comments yet. Start the discussion.