Skip to content
vishvanandaPublic

About

An ultra-fast C++ compiler

Resources

Stars

10 stars

Watchers

2 watching

Forks

Latest commit

 

History

4,800 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cppgm

Tests Upstream C and C++ correctness Clang build AArch64 backend Intel macOS port License: Apache 2.0 C++: 11 | 14 | 17 | selected 20 C: 90 | 95 | 99 | 11 | 17 | 23 Targets: x86-64 | AArch64 | wasm32 | i386 (experimental)

cppgm is an ultra-fast C and C++ compiler.

Language and target support

The C++ frontend follows the C++11, C++14 and C++17 profile with selected C++20 features. The C frontend supports C90, C95, C99, C11, C17 and C23 modes, including selected GNU extensions. C library coverage depends on the target SDK. See the C coverage inventory and the bare Wasm and WASI C23 library supplements.

Backend Target platforms
x86-64 Linux (ELF), Intel macOS (Mach-O)
AArch64 Linux (ELF), Apple Silicon macOS (Mach-O)
wasm32 Bare WebAssembly (wasm32-unknown-unknown) and WASI (wasm32-wasip1)
wasm64 (experimental) Freestanding C and GNU Wasm assembly with memory64 and table64. Link with an external Wasm linker.
i386 (experimental) Linux ELF32, freestanding integer C and x86 real-mode boot code

Linux 7.3.6 boots under QEMU with cppgm compiling and assembling every target input in a small native AArch64 virt configuration. The build uses LLD and exercises the native vDSO in userspace. Integrated assembly

cppgm also built the x86 kernel's 32-bit compatibility vDSO and real-mode boot objects and booted the kernel under QEMU. In the broader Arm defconfig build, cppgm compiled the AArch64 C, including the native vDSO. Clang assembled that configuration's Arm code and built its AArch32 compatibility vDSO. That configuration disabled kernel pointer authentication.

Correctness

SuiteResult / details
Internal assignment tests Latest validated internal assignment test count
GCC C++11 profile GCC C++11 profile: 3,968 / 3,968
Clang C++11 profile Clang C++11 profile: 815 / 815
Internal C++ subset · compile / run Internal C++ subset · all three compilers: 5,614 / 1,210
Public programs Public programs: 81 / 81
index-cpp index-cpp: 50 / 50
simdjson · scalar + SSE simdjson · scalar + SSE: passing
Boost · 17 suites Boost tests; all three compilers: 1,818 / 1,818
x86-64 self-build + inception Self-build + inception: passing
Student export Student export: passing
Godot Godot: 5 / 5 checked workloads, all three compilers

Coverage, exclusions and test scope.

Performance

Speedups compare cppgm with GCC or Clang at O3. Higher is faster. Where a cell contains three badges, they show GitHub-hosted EPYC, GitHub-hosted Intel and dedicated Intel, in that order. Green through red indicates the speedup, with red at 0.50× or below. n/m means unmeasured and n/a means inapplicable. An asterisk marks a measurement at least 10 commits behind main or outside its history. At 100 commits behind, a gray stale badge replaces the speedup. A gray Godot runtime badge with a dagger (†) means the reference binary's own time moved by more than 5% since its last run on the same processor. Measurement age

Application and library benchmarks on x86-64

WorkloadCompile vs GCC ↑Compile vs Clang ↑Runtime vs GCC ↑Runtime vs Clang ↑
Public programs public compile vs gcc: EPYC
public compile vs gcc: hosted Intel
public compile vs gcc: Intel
public compile vs clang: EPYC
public compile vs clang: hosted Intel
public compile vs clang: Intel
public runtime vs gcc: EPYC
public runtime vs gcc: hosted Intel
public runtime vs gcc: Intel
public runtime vs clang: EPYC
public runtime vs clang: hosted Intel
public runtime vs clang: Intel
index-cpp index compile vs gcc: EPYC
index compile vs gcc: hosted Intel
index compile vs gcc: Intel
index compile vs clang: EPYC
index compile vs clang: hosted Intel
index compile vs clang: Intel
index runtime vs gcc: EPYC
index runtime vs gcc: hosted Intel
index runtime vs gcc: Intel
index runtime vs clang: EPYC
index runtime vs clang: hosted Intel
index runtime vs clang: Intel
Internal C++ subset internal compile vs gcc: EPYC
internal compile vs gcc: CI Intel
internal compile vs gcc: Intel
internal compile vs clang: EPYC
internal compile vs clang: CI Intel
internal compile vs clang: Intel
n/a n/a
Boost tests Boost compile CPU vs gcc: EPYC
Boost compile CPU vs gcc: hosted Intel
Boost compile CPU vs gcc: Intel
Boost compile CPU vs clang: EPYC
Boost compile CPU vs clang: hosted Intel
Boost compile CPU vs clang: Intel
Boost native test CPU vs gcc: EPYC
Boost native test CPU vs gcc: hosted Intel
Boost native test CPU vs gcc: Intel
Boost native test CPU vs clang: EPYC
Boost native test CPU vs clang: hosted Intel
Boost native test CPU vs clang: Intel
Godot headless godot build vs gcc: EPYC
godot build vs gcc: hosted Intel
godot build vs gcc: Intel
godot build vs clang: EPYC
godot build vs clang: hosted Intel
godot build vs clang: Intel
godot runtime vs gcc: EPYC
godot runtime vs gcc: hosted Intel
godot runtime vs gcc: Intel
godot runtime vs clang: EPYC
godot runtime vs clang: hosted Intel
godot runtime vs clang: Intel

The public suite covers 81 third-party programs. Index-cpp times 50 checksummed workloads using elapsed time. The internal C++ row measures compilation only. Godot includes SCons and linking. Boost builds with assertions enabled and executes the C++ tests natively. Public programs · index-cpp · internal C++ · Boost · Godot

Backend performance

Each backend builds the compiler, runs a SIMD workload, and runs the same public programs. The public subset uses the original sources and inputs for sorting, floating-point matrix multiplication, recursive search and a C++ prime sieve that uses virtual calls. Each execution must match the same stdout checksum on all three targets. The public-subset badge shows the geometric mean of the five CPU speedups against Clang. Click it for individual program results and the measured revision. Shared public workloads · Main benchmark runs

WorkloadCompile vs GCC ↑Compile vs Clang ↑Runtime vs GCC ↑Runtime vs Clang ↑
x86-64 · native Linux
Compiler self-build cppgm compile vs gcc: EPYC
cppgm compile vs gcc: hosted Intel
cppgm compile vs gcc: Intel
cppgm compile vs clang: EPYC
cppgm compile vs clang: hosted Intel
cppgm compile vs clang: Intel
cppgm runtime vs gcc: EPYC
cppgm runtime vs gcc: hosted Intel
cppgm runtime vs gcc: Intel
cppgm runtime vs clang: EPYC
cppgm runtime vs clang: hosted Intel
cppgm runtime vs clang: Intel
simdjson scalar scalar compile vs gcc: EPYC
scalar compile vs gcc: hosted Intel
scalar compile vs gcc: Intel
scalar compile vs clang: EPYC
scalar compile vs clang: hosted Intel
scalar compile vs clang: Intel
scalar runtime vs gcc: EPYC
scalar runtime vs gcc: hosted Intel
scalar runtime vs gcc: Intel
scalar runtime vs clang: EPYC
scalar runtime vs clang: hosted Intel
scalar runtime vs clang: Intel
simdjson SSE sse compile vs gcc: EPYC
sse compile vs gcc: hosted Intel
sse compile vs gcc: Intel
sse compile vs clang: EPYC
sse compile vs clang: hosted Intel
sse compile vs clang: Intel
sse runtime vs gcc: EPYC
sse runtime vs gcc: hosted Intel
sse runtime vs gcc: Intel
sse runtime vs clang: EPYC
sse runtime vs clang: hosted Intel
sse runtime vs clang: Intel
Public subsetn/mx86-64 public subset runtime vs Clang
wasm32 · Wasmtime
Compiler self-build (WASI) n/a WASI cppgm build vs Clang: EPYC
WASI cppgm build vs Clang: CI Intel
WASI cppgm build vs Clang: Intel
n/a WASI cppgm rebuild vs Clang: EPYC
WASI cppgm rebuild vs Clang: CI Intel
WASI cppgm rebuild vs Clang: Intel
PA37 scalar n/a Wasm scalar compile vs Clang: EPYC
Wasm scalar compile vs Clang: hosted Intel
Wasm scalar compile vs Clang: Intel
n/a Wasm scalar runtime vs Clang: EPYC
Wasm scalar runtime vs Clang: hosted Intel
Wasm scalar runtime vs Clang: Intel
PA37 SIMD128 n/a Wasm simd128 compile vs Clang: EPYC
Wasm simd128 compile vs Clang: hosted Intel
Wasm simd128 compile vs Clang: Intel
n/a Wasm simd128 runtime vs Clang: EPYC
Wasm simd128 runtime vs Clang: hosted Intel
Wasm simd128 runtime vs Clang: Intel
Public subsetn/mWASI public subset runtime vs Clang
AArch64 · native Linux
Compiler self-buildArm64 cold build vs GCCArm64 cold build vs ClangArm64 rebuild vs GCC-built cppgmArm64 rebuild vs Clang-built cppgm
NEON arithmeticn/mArm64 NEON runtime vs GCCArm64 NEON runtime vs Clang
Public subsetn/mArm64 public subset runtime vs Clang
Public programs (81)Arm64 Public programs (81) compile vs GCCArm64 Public programs (81) compile vs ClangArm64 Public programs (81) runtime vs GCCArm64 Public programs (81) runtime vs Clang
index-cpp (50)Arm64 index-cpp (50) compile vs GCCArm64 index-cpp (50) compile vs ClangArm64 index-cpp (50) runtime vs GCCArm64 index-cpp (50) runtime vs Clang

For native self-builds, the compile columns time building cppgm. The runtime columns time the resulting compilers rebuilding the same sources. WASI compares cppgm with Clang targeting WASI and runs the resulting compilers in Wasmtime. The Wasm SIMD128 and scalar workloads time warmed exports in one engine. Arm64 kernel timings include integer and floating-point NEON. On native Linux Arm64, the full public and index-cpp suites compare cppgm with GCC and Clang at -O3. The index-cpp runtime column summarizes the 50 checksummed workloads. On Google Axion, 521b59b53 reached 0.966× Clang's throughput on the public suite (81 outputs matched, 80 timed) and 0.979× on index-cpp (50 checksums passed). On x86, QEMU can check the Arm executables and count guest instructions. Native Arm self-build, application timings and hardware counters · Arm optimization results and instruction profiles · Earlier QEMU measurements

Native self-build reports · simdjson · PA37 workloads · WASI self-build · Arm kernels · Local Arm benchmark instructions · Native Arm measurements against Clang · Dedicated Intel measurements

Caveats

  • PA38 remains an optional C assignment. The C23 mode is experimental.
  • -Oz and the LTO flags are experimental. -Oz optimizes for size. -flto=full optimizes consecutive source inputs together on Wasm, Linux x86-64 and both AArch64 targets. On these native targets, add -c -o combined.o to write a host-linkable ELF or Mach-O object. On AArch64, -flto is shorthand for full source LTO. On Wasm, -flto shares identical function bodies when linking objects. Full LTO needs the source files in the same command and can use more memory. Keep competing weak and strong definitions in separate objects so the linker can select one.
  • Integrated assembly is complete for its documented x86-64 profile. It is not a general assembler.
  • The compiler has no C++ standard library of its own. Use the library that is installed on the host.
  • The compiler can contain bugs.
  • The generated code can be slow for program shapes that the benchmarks do not cover.

Build and validate

The main target is Linux x86-64. Install a C++11 host compiler, GNU make, Bash, Perl and Python 3. Later checks also use binutils and a debugger.

make CXX=g++ CPPGM_HOST_CXX=g++
make test-report
make inception

To get only the compiler, check out dev/ without the course data and build cppgm:

git clone --depth 1 --filter=blob:none --sparse https://github.com/vishvananda/cppgm.git
git -C cppgm sparse-checkout set dev
make -C cppgm/dev cppgm CXX=g++ CPPGM_HOST_CXX=g++

To build with Clang, pass CXX=clang++ CPPGM_HOST_CXX=clang++. CC does not select the C++ host compiler. Use one host toolchain for a whole build.

The releases provide the tools and LowIR library for Linux x86-64, Linux AArch64, Intel macOS and Apple Silicon, plus WASI modules and two source downloads. Choose cppgm-<tag>-source.tar.gz to build the tools and library, or cppgm-<tag>-source-with-tests.tar.gz to build them and run the assignment suites. See reference and version exports.

The LowIR library guide covers object emission for x86-64, WebAssembly and AArch64 targets.

The macOS guide describes Intel macOS support and its optional checks.

More documents:

Origins and license

The original C++ Grandmaster Certification course supplied early assignment material, tests and starter code. The cppgm authors have substantially revised, combined, renumbered and extended that material into this independent course of 38 assignments. The handouts, the harnesses and the reference compiler describe this version. A PA number here does not identify an original CPPGM lesson.

Copyright 2026 The cppgm Authors. Code and materials that the project maintains use the Apache License 2.0. Inherited material keeps its original notices. See LICENSE, NOTICE and AUTHORS.

About

An ultra-fast C++ compiler

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages