You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/getting-started/introduction.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: "What Edge Python is and where to go next."
5
5
6
6
# Introduction
7
7
8
-
Edge Python is a sandboxed Python subset compiled to a ~170 KB WebAssembly module — built in Rust to run on Cloudflare Workers, Fastly Compute, and the browser.
8
+
Edge Python is a sandboxed Python subset compiled to a less 200 KB WebAssembly module release, built in Rust to run on Cloudflare Workers, and the browser.
9
9
10
10
## Explore
11
11
@@ -18,7 +18,7 @@ Edge Python is a sandboxed Python subset compiled to a ~170 KB WebAssembly modul
18
18
19
19
### Browser:
20
20
21
-
Run Edge Python live in your browser at [demo.edgepython.com](https://demo.edgepython.com/).
21
+
Run live in your browser at [demo.edgepython.com](https://demo.edgepython.com/).
`dom` is one of the official [host libraries](/reference/packages#host-libraries) (`dom`, `network`, `storage` and more); standard `.wasm` packages like [`json`](/reference/packages#json) sit alongside them. The `packages.json` above declares `dom` explicitly, but the browser runtime also resolves the official packages by bare name with no manifest at all (see [Defaults](/reference/packages#defaults)), fetching each lazily on first import. See [Official packages](/reference/packages) for the full catalog, and the [runtime README](https://github.com/dylan-sutton-chavez/edge-python/tree/main/runtime) for all `<edge-python>` attributes and the `imports` field for `.py` / `.wasm` modules.
45
+
`dom` is one of the official [host libraries](/reference/packages#host-libraries) (`dom`, `network`, `storage`,...); standard `.wasm` packages like [`json`](/reference/packages#json) sit alongside them. The `packages.json` above declares `dom` explicitly, but the browser runtime also resolves the official packages by bare name with no manifest at all (see [Defaults](/reference/packages#defaults)), fetching each lazily on first import. See [Official packages](/reference/packages) for the full catalog, and the [runtime README](https://github.com/dylan-sutton-chavez/edge-python/tree/main/runtime) for all `<edge-python>` attributes and the `imports` field for `.py` / `.wasm` modules.
Release build is around 170 KB on `wasm32-unknown-unknown` (`panic=abort`, `opt-level=z`, `lto=true`, `codegen-units=1`). Pipeline: LUT-driven lexer -> single-pass Pratt parser emitting SSA-versioned bytecode directly -> peephole constant-folding optimiser -> token-threaded interpreter with two layers of adaptive specialisation.
8
+
Release build, is a 200 KB on `wasm32-unknown-unknown` (`panic=abort`, `opt-level=z`, `lto=true`, `codegen-units=1`). Where the path is: LUT-driven lexer -> single-pass Pratt parser emitting SSA-versioned bytecode directly -> peephole constant-folding optimiser -> token-threaded interpreter with two layers of adaptive specialisation.
9
9
10
10
No AST, no IR, bytecode is the only intermediate representation. Around 13,000 lines of Rust; production deps are `hashbrown` and `itoa` (SHA-256 in-tree). WASM build adds `lol_alloc` for a single-threaded leaking bump allocator.
11
11
@@ -26,13 +26,13 @@ Classes support single-level inheritance, `super()`, full dunder dispatch, `@pro
26
26
Each `Instruction` is 4 bytes: 1-byte `OpCode` (`#[repr(u8)]` planned), 2-byte operand, 1 byte padding. Opcodes span 17 categories, load, store, arith, bitwise, compare, logic, identity, control flow, iter, build, container, comprehension, function, ssa (Phi), yield, side effects, unsupported (raises at runtime). Around 40 specialised `Call*` variants for hot builtins; `LoadAttr + Call(0)` pairs fuse into `CallMethod + CallMethodArgs` after first dispatch.
27
27
28
28
```text
29
-
OpCode::LoadConst operand = constant index
30
-
OpCode::LoadName operand = name slot
31
-
OpCode::StoreName operand = name slot
32
-
OpCode::Add / Sub operand = 0 (IC slot derived from ip)
33
-
OpCode::Call operand = (kw << 8) | pos
34
-
OpCode::Phi operand = target slot, sources in chunk.phi_sources
35
-
OpCode::ForIter operand = jump target on iterator exhaustion
29
+
OpCode::LoadConst -> operand = constant index
30
+
OpCode::LoadName -> operand = name slot
31
+
OpCode::StoreName -> operand = name slot
32
+
OpCode::Add / Sub -> operand = 0 (IC slot derived from ip)
33
+
OpCode::Call -> operand = (kw << 8) | pos
34
+
OpCode::Phi -> operand = target slot, sources in chunk.phi_sources
35
+
OpCode::ForIter -> operand = jump target on iterator exhaustion
0 commit comments