Dragon

The Dragon Programming Language

Reads like Python. Runs like C.

A statically typed, compiled language for people who write Python and need native speed.

$ dragon run hello.dr

Why Dragon?

Fast

Compiles to native code through LLVM. Dragon targets C-class performance with no interpreter and no GC pauses on the hot path.

🔒

Typed

Type annotations are mandatory and checked ahead of time. Mistakes become compile errors, not 2 a.m. pages.

🐍

Familiar

Syntax and standard-library APIs mirror Python 3. Dragon is its own language, not a Python runtime, but you will read it on day one.

🧵

Concurrent

Colorless green threads: fire a task, await it anywhere. One way to write code, scheduled M:N for free.

Familiar surface, static underneath

# Reads like Python, checked at compile time, runs on green threads.
class Greeter {
    def(name: str) {
        self.name = name
    }
    def hello() -> str {
        return f"Hello, {self.name}!"
    }
}

def work(n: int) -> int {
    return n * n
}

g: Greeter = Greeter("Dragon")
print(g.hello())

# Fire three green threads; await collects their results. No async/sync split.
tasks: list[Task[int]] = []
i: int = 0
while i < 3 {
    tasks.append(fire work(i))
    i = i + 1
}
for t in tasks {
    print(await t)
}

Compiled speed, measured

Best-of-3, all -O2, with Rust as the yardstick: it's the language with a comparable safety story, so it shows where our runtime still costs us. Dragon runs at parity on compute-bound work and behind on allocation-heavy work, where reference counting costs what a borrow checker does not. Both stay on the page.

BenchmarkDragonRustVerdict
Fibonacci (recursive, n=42) 0.848s 0.986s parity (1.16×, within noise)
Mandelbrot (float, 1600², 100 iter) 0.421s 0.452s parity (1.07×, within noise)
Sieve of Eratosthenes (1M) 0.007s 0.006s tie (noise)
String concat (10k) 0.003s 0.003s tie (noise)
Object creation (1M) 0.002s 0.003s tie (noise)
Parallel sum (8×30M fork-join) 0.174s 0.149s Dragon 1.17× slower
Dictionary / hashmap (3M str-key ops) 1.144s 0.666s Dragon 1.72× slower
Binary trees (alloc/GC churn, depth 14) 0.255s 0.095s Dragon 2.68× slower

Ready to breathe fire?