Reference measurements, July 2026

Performance is not one number.

Dudu has generated-program runtime, language frontend, C++ emission, native compilation, incremental build, editor, native-header, and macro costs. This page measures them separately.

0.94-1.03xDudu runtime relative to handwritten C++ across nine covered workloads
20.9 msMedian tiny duc check
72.6 msMedian generated-CMake no-op build
< 23 msSlowest p95 warm editor request in both dogfood workspaces

How to read these results

Dudu compiles source to C++20. A complete build therefore contains work performed by Dudu and work performed by the configured C++ toolchain. Reporting only the final duration would hide which part costs time and would make optimization results difficult to interpret.

Frontend
Lexing, parsing, module resolution, semantic analysis, and diagnostics.
C++ emission
Generating module headers, sources, runtime support, and source mappings.
Native backend
The external C++ compiler and linker. Dudu currently uses the host toolchain.
Generated runtime
The speed and memory use of the finished program after native optimization.
Cold
No reusable result for the measured operation. Operating-system file caches remain warm unless noted.
Incremental
Only invalidated Dudu modules and native objects are rebuilt.
Reference machine: AMD Ryzen 9 9950X, 16 cores / 32 threads, Ubuntu 24.04, GCC 13.3, Clang 18.1.3, Dudu 0.1.0-alpha.13 Release build. Published comparisons use five samples unless the section says otherwise and report median and p95 wall time.

Generated program runtime

The acceptance criterion is parity with equivalent handwritten C++ using the same data structures, operations, compiler, and optimization flags. The current suite uses GCC 13.3 with -O3 -DNDEBUG and 10,000,000 elements or iterations.

BenchmarkDudu medianC++ medianDudu / C++
Scalar arithmetic8.926 ms9.044 ms0.987
Pointer traversal9.539 ms9.293 ms1.026
Struct field access19.510 ms19.472 ms1.002
Fixed arrays19.349 ms19.501 ms0.992
list / std::vector109.968 ms110.810 ms0.992
Tuple return20.197 ms21.451 ms0.942
Function callback41.307 ms43.103 ms0.958
Particle update38.836 ms39.369 ms0.986
Eight-thread accumulation1.568 ms1.560 ms1.005

The observed range is 0.94-1.03 times handwritten C++. The differences are consistent with measurement and code-layout noise. This suite does not demonstrate a systematic Dudu runtime tax for the operations it covers. It is not a claim about every library, allocator, algorithm, or native API.

Reproduce the runtime suite
./scripts/bench.sh 10000000 --samples 5 \
    --emit-report build/benchmarks/runtime.json

Compiler and toolchain comparison

The compiler matrix generates equivalent programs containing primitive fields, records or classes, methods, functions, calls, and an entry point. The reference workload contains 1,000 units. Frontend and executable production are reported separately where each toolchain exposes both operations.

1 / frontend and emit219.4 msduc emit, including frontend analysis
2 / native backend256.4 msGCC compile and link
complete path477.4 msSelf-contained executable

Frontend checking

C++
21.7 ms
Rust
112.5 ms
Dudu
127.7 ms
Go
176.9 ms
Nim
233.9 ms
Swift
342.9 ms
Language / operationMedianp95Peak RSS
Dudu frontend127.7 ms132.4 ms63.7 MiB
Dudu duc emit, frontend included219.4 ms227.4 ms66.4 MiB
C++ backend for Dudu output256.4 ms259.3 ms90.7 MiB
Dudu complete executable477.4 ms482.5 ms90.7 MiB
C++ frontend21.7 ms23.3 ms27.5 MiB
C++ executable264.8 ms269.8 ms66.5 MiB
Rust frontend112.5 ms118.1 ms101.6 MiB
Rust executable141.1 ms142.1 ms124.2 MiB
Go frontend176.9 ms182.9 ms210.6 MiB
Go executable231.1 ms251.2 ms81.1 MiB
Nim frontend233.9 ms237.4 ms35.6 MiB
Nim executable383.5 ms392.6 ms39.9 MiB
Swift frontend342.9 ms347.1 ms115.1 MiB
Swift executable1,191.1 ms1,268.7 ms194.6 MiB
C# / MSBuild executable865.5 ms1,459.9 ms149.0 MiB
Cost relative to direct C++: this clean self-contained Dudu path is 1.80 times the equivalent C++ executable build. That ratio includes Dudu analysis and emission followed by GCC. Normal projects use per-module generated C++ and CMake-backed incremental builds, measured separately below.

Development and incremental build latency

The project-driver fixture contains two Dudu modules and a local native header. Private edits rebuild only the changed generated module. Public interface edits also rebuild dependents. CMake remains responsible for native source and header dependencies.

OperationMedianp95Peak RSS
Tiny duc check20.9 ms22.2 ms54.4 MiB
Project no-op check20.7 ms22.4 ms57.3 MiB
Generated-CMake no-op build72.6 ms75.5 ms56.3 MiB
Generated-CMake no-op run72.6 ms75.3 ms56.1 MiB
Generated-CMake no-op test72.4 ms75.2 ms56.0 MiB
Private dependency edit131.0 ms134.1 ms57.7 MiB
Public interface edit159.0 ms165.1 ms57.8 MiB
Native-header edit130.4 ms134.0 ms56.1 MiB
Build-configuration edit422.1 ms440.7 ms88.6 MiB
Dudu-only no-op module emit21.5 ms23.0 ms57.9 MiB
Dudu-only changed-module emit22.0 ms22.1 ms58.1 MiB

A no-op build still invokes cmake --build. This is the native dependency check that discovers edits to user C and C++ sources and headers. Dudu preserves generated modification times, skips configure, reports zero dirty modules, and lets CMake skip compilation and linking.

Frontend scaling and C++ emission

The broad scaling matrix generates several source shapes so a fast result for one parser pattern cannot hide a slow semantic path elsewhere. It includes inheritance, expressions, multidimensional indexing, operators, native declarations, and multi-module projects.

Source shape~10k lines~50k lines~100k linesClean emit at ~100k
Inheritance / abstract dispatch33.8 ms94.4 ms180.4 ms389.7 ms
Expression-heavy71.6 ms305.0 ms589.6 ms940.1 ms
Shaped indexing / swizzles63.5 ms258.5 ms502.9 ms838.5 ms
Overloaded operators54.9 ms196.8 ms375.5 ms638.7 ms
Native declarations / overloads102.0 ms436.3 ms870.3 ms1,490.6 ms
Mixed nine-module project44.0 ms144.3 ms289.3 ms378.4 ms

The 50k-to-100k curves are approximately linear. A class-heavy path that previously copied the complete symbol graph for every class took 2,651 ms at 50,000 lines; scoped symbol overlays reduced it to 84.8 ms. Follow-up measurements were 155.3 ms at 100,000 lines and 306.9 ms at 200,000 lines.

Generated output size

The compiler comparison's 10,003 lines of Dudu emit 20,023 lines of inspectable self-contained C++. Of those, 4,005 lines are blank and source-location comments consume 185,962 bytes. Removing comments and blank lines leaves 14,256 lines and 288,680 bytes. The remaining expansion is primarily forward declarations, prototypes, and out-of-line method definitions used to preserve declaration order and module boundaries.

Native-header awareness

Dudu uses Clang to import C and C++ declarations for compilation and editor intelligence. Cold scans pay Clang's header parsing cost. Cached checks load Dudu's serialized native metadata.

Header graphCold checkCached check
Small C fixture33.6 ms8.7 ms
string + unordered_map + vector1,035.0 ms48.8 ms
13-header STL fixture1,874.5 ms114.8 ms
SDL3190.0 ms36.1 ms
raylib68.8 ms13.3 ms

Direct imports are scanned as one translation unit, with isolated scans only when headers contain conflicting global declarations. Cached native metadata loading for the large fixture itself takes about 18 ms. Timing output separates libclang, AST dump, AST parse, macro preprocessing, cache, and serialization phases.

Editor latency

Each sample starts a fresh language server. Workspace usability is measured through immediate recovering-parser diagnostics. Full semantic and native diagnostics continue on one coalescing background worker. Warm requests run after project and native indexes are populated.

Workspace and operationMedianp95Peak RSS
raymarch-dd workspace usable7.5 ms8.0 ms280.6 MiB
raymarch-dd cached first native hover219.5 ms222.1 ms280.6 MiB
raymarch-dd slowest warm request21.0 ms22.8 ms280.6 MiB
dudu-webserver workspace usable7.5 ms7.8 ms173.7 MiB
dudu-webserver cached first native hover91.6 ms92.3 ms173.7 MiB
dudu-webserver slowest warm request11.8 ms12.3 ms173.7 MiB

The request probe covers definition, hover, references, completion, semantic tokens, rename, and native-aware hover. With native metadata removed, workspace usability remained 8.2 ms and 7.6 ms; the deliberately native hover then paid a background scan of 3.65 seconds and 1.08 seconds. Native scanning does not block parser diagnostics or unrelated Dudu requests.

Declaration macro compilation

The macro matrix defines 1,000 two-field types and generates one method for each type. Package downloads and the first toolchain dependency bootstrap are excluded. Dudu macro execution itself is about 16 ms; cold application time is dominated by compiling and linking the generated native worker.

LanguageClean appWarm appUnrelated editDecorated edit
Rust 1.94153.6 ms37.3 ms88.3 ms88.8 ms
Dudu410.1 ms52.5 ms53.3 ms67.5 ms
Nim 1.6819.7 ms176.2 ms192.6 ms194.5 ms
Swift 6.32,160.3 ms454.7 ms1,404.4 ms1,352.9 ms
C# / .NET 82,440.3 ms502.8 ms1,565.9 ms1,592.9 ms

Dudu's first SDK cache bootstrap is a separate one-time toolchain operation. Macro packages compile into separate translation units and reuse the stable generated SDK support. Warm and edit paths reuse package and expansion caches by content identity.

Reproduce the measurements

Benchmark harnesses generate their fixtures from source, capture exact compiler commands and versions, retain raw samples, and write structured reports under ignored build directories. The published tables are not typed into tests as expected constants; regression thresholds are maintained separately from informational cross-language comparisons.

Representative commands
# Runtime parity
./scripts/bench.sh 10000000 --samples 5

# Compiler and generated-output scaling
./scripts/bench_compiler.sh --build-type Release --samples 3 \
    --line-scales 10000,50000,100000 \
    --shapes inheritance,expressions,indexing,operators,native,mixed \
    --emit-scaling

# Cross-language compiler matrix
python3 scripts/bench_compiler_compare.py --samples 5

# Native headers
./scripts/bench_native_headers.py --samples 5

# Macro comparison
dudu bench compiler -- --suite macros --samples 5 \
    --compare rust,csharp,swift,nim

Current assessment

  • Generated runtime performance is in the intended C++ class for the covered operations.
  • The Dudu frontend is competitive with the measured modern-language frontends on the 1,000-unit fixture, but GCC checks equivalent C++ substantially faster.
  • Complete clean executable production costs more than direct C++ because Dudu adds frontend and emission work before invoking the C++ backend.
  • Per-module emission and CMake-backed incremental builds keep the normal edit loop much shorter than a clean self-contained build.
  • Cold large C++ header graphs remain visible. Serialized native metadata makes repeated checks substantially cheaper.
  • Warm editor requests are responsive in the current dogfood projects. First native symbol queries can still pay background scanning cost when no metadata cache exists.
  • The alpha label reflects compatibility, diagnostics, platforms, ABI stability, and ecosystem work. It does not mean generated programs run through an interpreter.
Scope: benchmark results describe the listed fixtures, machine, compiler versions, and flags. They are useful for finding regressions and understanding toolchain costs. They are not universal rankings of languages or guarantees for unrelated programs.