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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ specialized loop per archetype — which is what lets it beat bitECS, and it hol
edge as the world grows (no pre-sizing required; it falls back to a plain loop where a
strict CSP or sandbox forbids dynamic compilation).

You don't have to choose between the readable `.each` body and that speed:
[`query.compile`](https://github.com/andymai/ecsia/blob/main/website/guide/performance.md#compile-the-ergonomic-path-compile)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The query.compile link points to the raw GitHub source viewer (github.com/.../blob/main/...) rather than the deployed docs site used everywhere else in this file (e.g., https://andymai.github.io/ecsia/guide/performance). Readers will land on the Markdown source instead of the rendered documentation page.

Suggested change
[`query.compile`](https://github.com/andymai/ecsia/blob/main/website/guide/performance.md#compile-the-ergonomic-path-compile)
[`query.compile`](https://andymai.github.io/ecsia/guide/performance#compile-the-ergonomic-path-compile)
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 181

Comment:
The `query.compile` link points to the raw GitHub source viewer (`github.com/.../blob/main/...`) rather than the deployed docs site used everywhere else in this file (e.g., `https://andymai.github.io/ecsia/guide/performance`). Readers will land on the Markdown source instead of the rendered documentation page.

```suggestion
[`query.compile`](https://andymai.github.io/ecsia/guide/performance#compile-the-ergonomic-path-compile)
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

takes the same `e.position.x += …` callback, rewrites it into the `bindColumns`-shape loop, and lands
near `eachChunk` — roughly 6× faster than the plain `.each` it's written like — while still feeding
`.changed()`/observers. It's a pure speedup that falls back to the normal loop for anything it can't
compile.

Worker-thread speedup on a compute-heavy simulation (8,192 entities, 512 physics
steps per frame, 60 frames), with every threaded run byte-identical to the
single-threaded result:
Expand Down
11 changes: 8 additions & 3 deletions website/guide/core-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ for (const e of world.query(read(Velocity), write(Position))) {
Other query terms — `has(C)`, `without(C)`, and `optional(C)` — refine which entities
match without (or optionally) binding accessors.

For the rare loop that needs every nanosecond, queries also offer a bind-once fast path,
[`bindColumns`](/guide/performance#bind-your-loop-once-bindcolumns) — the
[performance page](/guide/performance) covers it.
When a hot loop matters, keep this exact ergonomic body and hand it to
[`query.compile`](/guide/performance#compile-the-ergonomic-path-compile): it rewrites your
`e.position.x += …` callback into a specialized column loop — roughly **6× faster than the plain
`.each`**, on par with raw column access, and it still feeds `.changed()`/observers. It is a pure
speedup that falls back to the normal loop for anything it can't compile, so there's no syntax to
learn and no result to second-guess. (For the last nanosecond on a loop you're willing to write
against raw typed arrays, [`bindColumns`](/guide/performance#bind-your-loop-once-bindcolumns) drops
the reactivity bookkeeping too — the [performance page](/guide/performance) covers both.)
### Deriving narrower queries
Comment on lines +114 to 115

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The closing parenthesis of the new paragraph runs directly into the ### Deriving narrower queries heading with no blank line. Most Markdown parsers require a blank line before ATX headings to render them correctly.

Suggested change
the reactivity bookkeeping too — the [performance page](/guide/performance) covers both.)
### Deriving narrower queries
the reactivity bookkeeping too — the [performance page](/guide/performance) covers both.)
### Deriving narrower queries
Prompt To Fix With AI
This is a comment left during a code review.
Path: website/guide/core-concepts.md
Line: 114-115

Comment:
The closing parenthesis of the new paragraph runs directly into the `### Deriving narrower queries` heading with no blank line. Most Markdown parsers require a blank line before ATX headings to render them correctly.

```suggestion
the reactivity bookkeeping too — the [performance page](/guide/performance) covers both.)

### Deriving narrower queries
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code


`query.derive(...terms)` builds the query for *this query's terms plus the new ones*.
Expand Down
Loading