C++17

Skip CMake. Match Clang.

Write a numeric kernel in C++. zlow compiles it to LLVM, no CMake, no Make, no clang++ on the compile path. If we can't compile it correctly, we refuse it.

Matches Clang

6.4 ms to run the branchy kernel. clang++ -O2 took 6.4 ms on the same source. The gap is below the noise floor.

Checked against Clang

60/60 fixtures agree with pinned Homebrew Clang 22.1.8, or are refused by name.

LLVM text

zlow writes LLVM with --emit-llvm. kernel-v0 refuses -o and shared libraries.

Small on purpose

v0 is double, bool, and control flow. Keep the rest of the app in C++.

6.4 ms

to run the kernel

1.0×

Clang on the same source

Lightning fast

Same kernel. Both sides are -O2 binaries; only entry() is timed.

zlowup to 1× faster than clang++
6.4 msentry()
clang++
6.4 msentry()
Branchy kernel, both -O2. 6.4 ms vs 6.4 ms is below the A-vs-A floor. Across five kernels the only gap above the floor is recursive at 1.1×, and that Clang spread is 27%. 60/60 fixtures match Clang on bits.

What's in v0

A kernel, not a rewrite of the C++ compiler. Keep the app in C++; compile the hot path.

You can write

  • double and bool top-level functions
  • const, if, while, and the ternary operator
  • arithmetic, comparisons, and boolean ops
  • calls between functions in the same project

Not this

  • the preprocessor, headers, and #include
  • classes, templates, namespaces, and exceptions
  • integers, pointers, references, and for
  • CMake, Make, and clang++ on the compile path

Fully featured

Compile the hot path to LLVM. Keep writing C++.

Try it

Install the CLI, add a project file, then compile from that folder.

Terminal
npm install @zlow/cli
zlow native . --emit-llvm kernel.ll

More C++ commands