Skip to content
Kavachकवच

Benchmarks

41 whole programs, each written in Kavach, C++ and often Python, Go or C#, run on one machine. Kavach is faster than C++ in 31 of 36 of them, and the others are here too.

How these are measured

  • The same algorithm in every language, written the way a fluent programmer would.
  • Whole programs, start to finish, on the same machine; the best of several runs.
  • Every number is read from the benchmark's README, where each run is recorded, never typed into this page.
  • Each suite ends with one command to run it yourself.
  • In a race, every bar fills at the same speed: milliseconds to scale, so the first to finish is the fastest.

The machine

Every suite here ran on one laptop, unless its README says otherwise.

CPUIntel Core i7-13700HX: 16 cores (8 fast, 8 efficient), 24 threads
Memory32 GB DDR5-4800 (two 16 GB modules); WSL gets 15.6 GB of it
GPUNVIDIA GeForce RTX 4050 Laptop GPU, 6 GB (and the CPU's Intel UHD Graphics)
WindowsWindows 11 Home 10.0.26300, power plan Balanced, on mains power
LinuxWSL 2 on the same machine: Ubuntu 24.04, kernel 5.15.167.4-microsoft-standard-WSL2

Loops, calls and lists

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9 · measured 2026-11-11 · how Kavach does it: Loops on all cores

loop — 500M rounds of modular arithmetic · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9

Kavach60 ms · finished 1st
C++ -O21,361 ms · 23× behind
Go1,377 ms · 23× behind
C#1,561 ms · 26× behind

sort — 5M integers · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9

Kavach32 ms · finished 1st
C++ -O2361 ms · 11× behind
Go450 ms · 14× behind
C#572 ms · 18× behind

lists — build, read, change and sum 10M items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9

Kavach32 ms · finished 1st
C++ -O273 ms · 2.3× behind
Go124 ms · 3.9× behind
C#211 ms · 6.6× behind

text — build, split and search large text · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9

Kavach38 ms · finished 1st
C++ -O271 ms · 1.9× behind
Go109 ms · 2.9× behind
C#257 ms · 6.8× behind

sizedmaps — 2M keys into a map told its size (C++ reserves too) · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Go 1.23 · .NET 8 (C# start-up included) · best of 9

Kavach49 ms · finished 1st
C++ -O269 ms · 1.4× behind
Go250 ms · 5.1× behind
C#218 ms · 4.4× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/loops

Math on large data

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9 · measured 2026-11-09 · how Kavach does it: Loops on all cores

sum — 50 million integers, 10 times, every addition overflow-checked · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach135 ms · finished 1st
C++ -O2363 ms · 2.7× behind

scale — y = x * 2.5 + 1.0 over 20 million floats, 10 times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach110 ms · finished 1st
C++ -O2274 ms · 2.5× behind

roots — sqrt over 20 million floats, 10 times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach201 ms · finished 1st
C++ -O2433 ms · 2.2× behind

dot — the dot product of two 20-million-float lists, 10 times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach184 ms · finished 1st
C++ -O2198 ms · 1.1× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/math

Method chains

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 · measured 2026-11-09 · how Kavach does it: Method chains

datachain — map, filter, map, sum over 10 million items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9

Kavach18 ms · finished 1st
C++ -O235 ms · 1.9× behind
Python 3.12957 ms · 53× behind

builderchain — five chained builder calls, 10 million times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9

Kavach13 ms · finished 1st
C++ -O217 ms · 1.3× behind
Python 3.1273,561 ms · 5659× behind

nestedchain — a chain inside a chain, ten thousand rows · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9

Kavach34 ms · finished 1st
C++ -O234 ms · finished 1st
Python 3.12942 ms · 28× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/chains

Everyday operations

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9 · measured 2026-11-09 · how Kavach does it: Functions as values

alloc — a short-lived list made, read and freed 20 million times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach1 ms · finished 1st
C++ -O2206 ms · 206× behind

callbacks — a callback held in a record, called 100 million times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach105 ms · finished 1st
C++ -O2177 ms · 1.7× behind

nested — fifty handlers each wrapping the next, 100 million hops · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach384 ms · finished 1st
C++ -O2470 ms · 1.2× behind

copies — a record copied, changed and read 100 million times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach73 ms · finished 1st
C++ -O275 ms · 1× behind

branches — an if/else chain decided 200 million times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach142 ms · finished 1st
C++ -O2166 ms · 1.2× behind

stacks — recursion 100 thousand frames deep, a thousand times · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach58 ms · finished 1st
C++ -O258 ms · finished 1st
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/everyday

Single reads, large data

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3) · measured 2026-11-09 · how Kavach does it: Maps

dict — 20M random reads from a 2M-entry map · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach272 ms · finished 1st
C++ -O2613 ms · 2.3× behind
Python 3.129,195 ms · 34× behind

index — 50M random reads from a 10M-item list · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach300 ms · finished 1st
C++ -O2561 ms · 1.9× behind
Python 3.1217,450 ms · 58× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/lookups

As data grows

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3) · measured 2026-11-09 · how Kavach does it: As data grows

index — 50M random reads from a list of 1,000 items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach170 ms · finished 1st
C++ -O2171 ms · 1× behind
Python 3.125,825 ms · 34× behind

index — 50M random reads from a list of 1,000,000 items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach157 ms · 1× behind
C++ -O2153 ms · finished 1st
Python 3.1211,815 ms · 77× behind

index — 50M random reads from a list of 10,000,000 items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach486 ms · finished 1st
C++ -O2502 ms · 1× behind
Python 3.1217,957 ms · 37× behind

index — 50M random reads from a list of 100,000,000 items · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach655 ms · finished 1st
C++ -O2896 ms · 1.4× behind
Python 3.1229,496 ms · 45× behind

sort — 1,000 integers · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach1 ms · finished 1st
C++ -O21 ms · finished 1st
Python 3.1231 ms · 31× behind

sort — 1,000,000 integers · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach14 ms · finished 1st
C++ -O262 ms · 4.4× behind
Python 3.12426 ms · 30× behind

sort — 10,000,000 integers · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach80 ms · finished 1st
C++ -O2716 ms · 8.9× behind
Python 3.125,420 ms · 68× behind

sort — 100,000,000 integers · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach988 ms · finished 1st
C++ -O28,497 ms · 8.6× behind
Python 3.1276,783 ms · 78× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/sizes

JSON on large data

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs · measured 2026-11-11 · how Kavach does it: JSON

300,000 orders (52 MB): write, parse, read, decode · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs

Kavach851 ms · finished 1st
Python 3.125,270 ms · 6.2× behind

stringify — every order to JSON text · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs

Kavach189 ms · finished 1st
Python 3.121,244 ms · 6.6× behind

parse — the text back into dynamic values · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs

Kavach176 ms · finished 1st
Python 3.12578 ms · 3.3× behind

read — qty and price of 1.5M items from parsed values · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs

Kavach91 ms · 1.8× behind
Python 3.1252 ms · finished 1st

decode — the text straight into records · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · Python 3.12 (its json module is C) · typical of 5 runs

Kavach294 ms · finished 1st
Python 3.122,282 ms · 7.8× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach kavach build benchmarks/json/kavach/json.kav && ./json; python3 benchmarks/json/python/json_bench.py

Raw bytes

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9 · measured 2026-11-09 · how Kavach does it: Byte-packed lists

crc — build 64 MB byte by byte, checksum it (CRC32C) · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · best of 9

Kavach57 ms · finished 1st
C++ -O263 ms · 1.1× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/bytes

Tasks on all cores

WSL Ubuntu 24.04 · i7-13700HX (8 fast cores) · kavach build (LLVM) · g++ 13 -O2 · best of 3 rounds of 3 runs · measured 2026-11-10 · how Kavach does it: Tasks

parallel_map: eight sums of 150M rounds each, one task each · WSL Ubuntu 24.04 · i7-13700HX (8 fast cores) · kavach build (LLVM) · g++ 13 -O2 · best of 3 rounds of 3 runs

Kavach210 ms · finished 1st
C++554 ms · 2.6× behind

map: the same eight sums, one after another · WSL Ubuntu 24.04 · i7-13700HX (8 fast cores) · kavach build (LLVM) · g++ 13 -O2 · best of 3 rounds of 3 runs

Kavach164 ms · finished 1st
C++4,261 ms · 26× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach kavach build benchmarks/tasks/kavach/parallel-map.kav && ./parallel-map

Channels

WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3) · measured 2026-11-09 · how Kavach does it: Channels

pipe — 2M integers from one task to another, capacity 1024 · WSL Ubuntu 24.04 · i7-13700HX · kavach build (LLVM) · g++ 13 -O2 · Python 3.12 · best of 9 (Python best of 3)

Kavach69 ms · finished 1st
C++ -O2 (mutex queue)234 ms · 3.4× behind
Python 3.122,418 ms · 35× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/channels

Network waits

WSL Ubuntu 24.04 · i7-13700HX · g++ 13 -O2 · Python 3.12 · measured 2026-11-03 · how Kavach does it: HTTP

pingpong — 10,000 TCP round trips between two tasks (Linux) · WSL Ubuntu 24.04 · i7-13700HX · g++ 13 -O2 · Python 3.12

Kavach110 ms · finished 1st
C++, blocking sockets300 ms · 2.7× behind
Python 3.12448 ms · 4.1× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/net

Many network clients

WSL Ubuntu 24.04 · i7-13700HX · g++ 13 -O2 · measured 2026-11-03 · how Kavach does it: Tasks

clients — an echo server with 100 clients, 1,000 round trips each · WSL Ubuntu 24.04 · i7-13700HX · g++ 13 -O2

Kavach, a coroutine per task1,040 ms · 11× behind
C++, all 24 cores93 ms · finished 1st
C++, one core345 ms · 3.7× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/net

On the GPU

Windows 11 · i7-13700HX · RTX 4050 Laptop · g++ -O3 -march=native -fopenmp for 24 threads · how Kavach does it: On the GPU

glow, first map — 4 million Float32 items, 1,000 steps each, sent to the GPU · Windows 11 · i7-13700HX · RTX 4050 Laptop · g++ -O3 -march=native -fopenmp for 24 threads

Kavach on the GPU207 ms · finished 1st
C++ on 24 threads296 ms · 1.4× behind
C++ -O2, one core6,744 ms · 33× behind
Kavach on the CPU7,017 ms · 34× behind

glow, second map — the same list, already in GPU memory · Windows 11 · i7-13700HX · RTX 4050 Laptop · g++ -O3 -march=native -fopenmp for 24 threads

Kavach on the GPU5 ms · finished 1st
C++ on 24 threads302 ms · 60× behind
C++ -O2, one core6,631 ms · 1326× behind
Kavach on the CPU7,059 ms · 1412× behind
Verify itgit clone https://github.com/Mithlesh04/kavach && cd kavach sh scripts/run-benchmarks.sh "" benchmarks/gpu