The Dragon Programming Language
Reads like Python. Faster than Rust.
$ 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, so the language reads like code you already know.
Concurrent
Colorless green threads: fire a task, await it anywhere. One way to write code, scheduled M:N for free.
Looks like Python. Runs like C.
# Typed like Rust, reads like Python, 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)
}
Faster than Rust on compute
Best-of-3, all -O2. We lead on compute-bound work and stay honest about the allocation and hashmap gaps we're still closing.
| Benchmark | Dragon | Rust | Verdict |
|---|---|---|---|
| Fibonacci (recursive, n=42) | 0.848s | 0.986s | Dragon 1.16× faster |
| Mandelbrot (float, 1600², 100 iter) | 0.421s | 0.452s | Dragon 1.07× faster |
| 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 |