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/content/architecture/index.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,15 +45,15 @@ allowing queries to quickly determine which archetypes are relevant.
45
45
46
46
Once matching archetypes are identified, queries can linearly iterate over their entities, a process that is both highly efficient and cache-friendly, thanks to the tight memory layout of archetype tables.
47
47
48
-
Component access through queries is extremely fast, often achieving near-constant time performance (~1ns per component) due to predictable memory access patterns and minimal indirection.
48
+
Component access through queries is extremely fast (below 1ns per component) due to predictable memory access patterns and minimal indirection.
49
49
50
50
## World entity access
51
51
52
52
To retrieve components for a specific entity outside of query execution,
53
53
the World maintains a list indexed by entity ID (as shown leftmost in the diagram above).
54
54
Each entry in this list points to the entity's archetype and the position within the archetype's table.
55
55
56
-
This setup enables fast random access to component data, though slightly slower than query-based iteration (≈2ns vs. ≈1ns), due to the additional indirection.
56
+
This setup enables fast random access to component data, though slightly slower than query-based iteration (≈2ns vs. <1ns), due to the additional indirection.
57
57
58
58
Note that the entity list also contains entities that are currently not alive,
59
59
because they were removed from the {{< api ecs World >}}.
@@ -76,7 +76,7 @@ and that different "incarnations" of same entity ID can be distinguished.
76
76
Archetypes are primarily designed to maximize iteration speed by grouping entities with identical component sets into tightly packed memory layouts.
77
77
This structure enables blazing-fast traversal and component access during queries.
78
78
79
-
However, this optimization comes with a trade-off: Adding or removing components from an entity requires relocating it to a different archetype, essentially moving all of its component data. This operation typically costs ~10–20ns per involved component.
79
+
However, this optimization comes with a trade-off: Adding or removing components from an entity requires relocating it to a different archetype, essentially moving all of its component data. This operation typically costs ≈20ns per involved component.
80
80
81
81
To reduce the number of archetype changes, it is recommended to add/remove/exchange multiple components at the same time rather than one after the other. Further, operations can be [batched](../batch) to manipulate many entities in a single command. See chapter [Performance tips](../performance) for more details.
0 commit comments