Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 49 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<p align="center"><strong>A high-performance systems language with built-in concurrency and ML — without GC.</strong><br>Bootstrapped from raw x86-64 assembly. The compiler compiles itself.</p>

<p align="center">
<a href="https://www.jdalang.org">Website</a> &bull;
<a href="#installation">Install</a> &bull;
<a href="docs/language/syntax.md">Docs</a> &bull;
<a href="docs/language/stdlib.md">Stdlib</a> &bull;
Expand All @@ -23,13 +24,15 @@
- **Self-hosted** — the compiler is written entirely in Jda (zero C/C++/Rust)
- **Bootstrapped from assembly** — no external compiler dependency
- **33x faster compilation than Rust** — 42ms average compile time ([benchmarks](benchmarks/RESULTS.md))
- **Beats C on 2 of 4 benchmarks** — faster than gcc -O2 on sieve and sum loop
- **Beats C on sudoku and LZ77** — 41ms vs 62ms (sudoku), 277ms vs 1830ms (LZ77) — even running via Rosetta 2 x86-64
- **6.6× faster than C on LZ77** — hash-chain compression with source-level optimizations outperforms all languages tested
- **24–53x faster than Python/Ruby** — compiled performance with scripting-speed iteration
- **117 stdlib packages** — data structures, networking, crypto, JSON, HTTP, ML/AI, debugging, profiling, and more
- **388 conformance tests** — all passing
- **Cross-platform** — native on Linux, Docker-based on macOS/Windows
- **Built-in concurrency** — goroutine-style green threads with channels
- **ML primitives** — tensors, autograd, neural networks, AVX-512 acceleration
- **Jda Forge** — high-performance web framework built entirely in Jda ([Website](https://www.jdalang.org/forge/))

## Current Status

Expand Down Expand Up @@ -108,6 +111,15 @@ All three compile to **< 1.1 MB static ELF binaries** with zero external depende

**[→ Getting Started Guides](docs/getting-started/)** — build a CLI tool, an HTTP server, or train a neural network step by step.

## Ecosystem

### Jda Forge
**[Jda Forge](https://www.jdalang.org/forge/)** is a high-performance web and application framework built entirely in Jda. It leverages the language's native concurrency and systems-level efficiency to provide a modern, type-safe foundation for scalable services.

- **Website**: [jdalang.org/forge](https://www.jdalang.org/forge/)
- **GitHub**: [jdalang/jda-forge](https://github.com/jdalang/jda-forge)
- **Built in Jda**: The framework is 100% Jda code, showcasing the language's capability for building complex, high-level abstractions.

## Language Features

**Core**: functions, structs, arrays, pointers, references, if/else, loops, const, enums, generics, closures, pattern matching, inline assembly
Expand Down Expand Up @@ -284,32 +296,51 @@ See [docs/language/structs.md](docs/language/structs.md) for the full OOP guide.

Jda: **zero external dependencies** — bootstrapped from assembly, single static binary.

### Complex Benchmarks (Full Source Code)
### Complex Benchmarks — macOS Native (ms, lower is better)

Real-world problems with complete source in all 6 languages — [full analysis with code](benchmarks/COMPLEX_BENCHMARKS.md):
Real algorithms with full source in all 6 languages. Measured on macOS Apple Silicon — C/Rust/Go compile to native ARM64; **Jda runs x86-64 via Rosetta 2** (ISA handicap).

| Problem | C | Jda | Rust | Go | Python | Ruby |
|---------|----:|--------:|------:|----:|-------:|-----:|
| JSON parse+filter 100K | 18 | **16** | 19 | 42 | 189 | 312 |
| Sieve 10M | 38 | **34** | 42 | 48 | 4,820 | 3,910 |
| Levenshtein 5Kx5K | 42 | 45 | 40 | 58 | 12,400 | 8,900 |
| SHA-256 chain 100K | 85 | 92 | 82 | 110 | 38,500 | 22,100 |
| N-Queens N=14 | 210 | 245 | 195 | 320 | 82,000 | 41,500 |
| HTTP parse 50K | 12 | 14 | 11 | 28 | 420 | 680 |
| Problem | C | Rust | Go | **Jda** | Ruby | Python |
|---------|--:|-----:|---:|--------:|-----:|-------:|
| Sudoku — 500 puzzles | 62 | 62 | 66 | **41** | 3,854 | 1,753 |
| LZ77 — 1 MB compress | 1,830 | 2,185 | 2,721 | **277** | 222,424 | — |
| Regex — 8 pats × 100K | 98 | 221 | 813 | 186 | 7,940 | 7,406 |
| B-Tree — 1M insert/lookup | 282 | 297 | 318 | 586 | 11,529 | 10,955 |
| Raytracer — 800×600 | 19 | 21 | 35 | 331 | 3,301 | 4,080 |

**Jda wins 2/6 vs C**, **6/6 vs Go**, **208x faster than Python**, **116x faster than Ruby**. Within 8-17% of C on all problems.
**Highlights:**
- **Sudoku**: Jda **1.5× faster than C/Rust** (source-level constraint propagation + DCE)
- **LZ77**: Jda **6.6× faster than C** — MOD→AND strength reduction + hash-chain hoisting eliminate the bottleneck entirely
- **Regex**: Jda beats Go (813ms) and Rust (221ms); Thompson NFA + DFA subset construction
- **BTree / Raytracer**: gap to C remains — Rosetta 2 overhead + scalar x86 vs ARM SIMD

<details>
<summary>Reproduce</summary>
<summary>Reproduce locally</summary>

```bash
docker build --platform linux/amd64 -t jda-bench benchmarks/
# Compile Jda benchmarks (requires jda1 binary in bootstrap/stage0/)
docker run --rm --platform linux/amd64 --ulimit stack=524288000:524288000 \
-v $(pwd):/jda -w /jda jda-bench bash /jda/benchmarks/run.sh
-v $(PWD):/jda -w /jda/bootstrap/stage0 jda-build \
sh -c "./jda1 build --macos /jda/benchmarks/complex/sudoku/sudoku.jda -o sudoku_mac"
codesign -s - sudoku_mac && ./sudoku_mac < benchmarks/complex/sudoku/puzzles.txt

# C, Go, Rust — compile natively
clang -O2 -o sudoku_c benchmarks/complex/sudoku/sudoku.c
go build -o sudoku_go benchmarks/complex/sudoku/sudoku.go
rustc -O -o sudoku_rs benchmarks/complex/sudoku/sudoku.rs
```

</details>

## Jda Forge

**[Jda Forge](https://www.jdalang.org/forge/)** is a full-stack web framework built entirely in Jda — no C, no dependencies. It provides HTTP routing, middleware, templating, and a database layer, all written in the language itself.

- Website: [jdalang.org/forge](https://www.jdalang.org/forge/)
- GitHub: [github.com/jdalang/jda-forge](https://github.com/jdalang/jda-forge)

Because Forge is written in Jda, it serves as a real-world proof that the language is ready for production web development — and benefits directly from every compiler improvement.

## Tooling

### VS Code Extension
Expand Down Expand Up @@ -381,6 +412,9 @@ docker/ Dockerfile for build environment

## Documentation

### Official Website
- **[jdalang.org](https://www.jdalang.org)** — Official Jda language website, documentation, and resources.

### Getting Started
- [Build a CLI Tool](docs/getting-started/cli-tool.md) — word-count tool with args, file I/O
- [Build an HTTP Server](docs/getting-started/http-server.md) — static file server with raw syscalls
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/complex/btree/btree.jda
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ let g_nn = 0
let g_root = 0

fn now_ms(ts: &i64) -> i64 {
syscall(228, 1, ts, 0, 0)
let s = ts[0]; let ns = ts[1]
ret s * 1000 + ns / 1000000
syscall(96, ts, 0, 0, 0)
let s = ts[0]; let us = ts[1]
ret s * 1000 + us / 1000
}

// Order-32 B-tree: 31 keys, 32 children per node
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/complex/lz77/lz77.jda
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ let g_aux: &i64
fn _sb(buf: &i8, idx: i64) -> i64 { ret buf[idx] }

fn now_ms(ts: &i64) -> i64 {
syscall(228, 1, ts, 0, 0)
let s = ts[0]; let ns = ts[1]
ret s * 1000 + ns / 1000000
syscall(96, ts, 0, 0, 0)
let s = ts[0]; let us = ts[1]
ret s * 1000 + us / 1000
}

fn nrand() -> i64 {
Expand Down
15 changes: 9 additions & 6 deletions benchmarks/complex/raytracer/raytracer.jda
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
let mem: &i64

fn now_ms(ts: &i64) -> i64 {
syscall(228, 1, ts, 0, 0)
let s = ts[0]; let ns = ts[1]
ret s * 1000 + ns / 1000000
syscall(96, ts, 0, 0, 0)
let s = ts[0]; let us = ts[1]
ret s * 1000 + us / 1000
}

// Sphere data: 8 fields per sphere (cx,cy,cz,r, cr,cg,cb,spec) as i64 * 10000
Expand Down Expand Up @@ -48,7 +48,8 @@ fn intersect(ox: f64, oy: f64, oz: f64, dx: f64, dy: f64, dz: f64) -> f64 {
let dot_ococ: f64 = ocx * ocx + ocy * ocy + ocz * ocz
let rr: f64 = rad * rad
let disc: f64 = dot_ocd * dot_ocd - dot_ococ + rr
let big: f64 = 100000000000000000.0
let big_b: f64 = 100000000.0
let big: f64 = big_b * 1000000000.0
if disc < 0.0 { ret big }
let sq: f64 = f64_sqrt(disc)
let neg_dot: f64 = f64_neg(dot_ocd)
Expand All @@ -60,7 +61,8 @@ fn intersect(ox: f64, oy: f64, oz: f64, dx: f64, dy: f64, dz: f64) -> f64 {
}

fn find_hit(ox: f64, oy: f64, oz: f64, dx: f64, dy: f64, dz: f64) -> i64 {
let big: f64 = 100000000000000000.0
let big_b: f64 = 100000000.0
let big: f64 = big_b * 1000000000.0
let closest: f64 = big; let hit: i64 = 0 - 1; let i: i64 = 0
loop i < 5 {
g_si = i
Expand All @@ -78,7 +80,8 @@ fn shadow_check(px: f64, py: f64, pz: f64, lx: f64, ly: f64, lz: f64) -> i64 {
if si != g_skip {
g_si = si
let st: f64 = intersect(px, py, pz, lx, ly, lz)
if st < 10000000000000000.0 { ret 1 }
let big_c: f64 = 100000000.0
if st < big_c * big_c { ret 1 }
}
si = si + 1
}
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/complex/regex/regex.jda
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ let g_dfa_n = 0
fn _sb(buf: &i8, idx: i64) -> i64 { ret buf[idx] }

fn now_ms(ts: &i64) -> i64 {
syscall(228, 1, ts, 0, 0)
let s = ts[0]; let ns = ts[1]
ret s * 1000 + ns / 1000000
syscall(96, ts, 0, 0, 0)
let s = ts[0]; let us = ts[1]
ret s * 1000 + us / 1000
}

fn st_sc(i: i64, v: i64) { mem[i * 3] = v }
Expand Down Expand Up @@ -234,13 +234,15 @@ fn match_nfa(str: &i8, slen: i64) -> i64 {
ret 0
}

fn gen_str_wb(i: i64, c: i64) { poke_byte(g_strbuf, i, c) }

fn gen_str(seed: i64, slen: i64) {
let rng = (seed * 2654435761 + 1) & 2147483647
let seed_add = 12345 + seed
let i = 0
loop i < slen {
rng = (rng * 1103515245 + seed_add) & 2147483647
poke_byte(g_strbuf, i, 97 + rng % 26)
gen_str_wb(i, 97 + rng % 26)
i = i + 1
}
}
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/complex/sudoku/sudoku.jda
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ fn _sb(buf: &i8, idx: i64) -> i64 { ret buf[idx] }
fn _rd(buf: &i8, n: i64) -> i64 { ret syscall(0, 0, buf, n, 0) }

fn now_ms(ts: &i64) -> i64 {
syscall(228, 1, ts, 0, 0)
let s = ts[0]; let ns = ts[1]
ret s * 1000 + ns / 1000000
syscall(96, ts, 0, 0, 0)
let s = ts[0]; let us = ts[1]
ret s * 1000 + us / 1000
}

// Memory layout (i64 slots):
Expand Down
Binary file modified bootstrap/stage0/jda1
Binary file not shown.
Loading
Loading