Skip to content
Kavachकवच

How Kavach Is Fast

● Advanced4 min

Kavach is fast because it does less work: no interpreter, no garbage collector, no copies it can avoid, and every core when a loop allows it.

HowWhat it saves
Native machine codeprograms compile to machine code through LLVM or Cranelift, with no interpreter and no virtual machine in between
No garbage collectormemory is freed the moment its last use ends, so a program never stops for a collector
Values never aliasa list has one owner, so the compiler can keep values in registers and run loops on every core safely
Loops on all coresa plain loop is split over every core, with the one-core result exactly
Packed small numbersa list of bytes or Bools takes one byte per item, so eight times as many fit in the fast caches
Radix sortwhole numbers sort in a few passes by digit, not by comparing pairs
Fused pipelinesa chain of map, filter and sum runs as one loop, with no list built between the steps
The GPUa map with a gpu fn runs on thousands of GPU threads

None of these change what a program prints. A loop on all cores gives the one-core answer, the GPU gives the CPU's, and a sum of floats keeps its order: speed never changes a result.

Every speed claim on this site comes from a benchmark you can run yourself, against C++ and Python, with the exact commands: see Benchmarks.