Engine note
Streaming VM startup snapshot
Live sessions (rove join --session-seconds … --script) and rove replay-stream
start the VM from a startup snapshot plus a projected view of the same received
world revision. Each received property is already shared through that view, so
compact_snapshot removes the properties, origins and property_revisions
sections from every node the view resolves.
Before this change, startup first copied the whole received world into one JSON
document (WorldStore::to_snapshot), normalized every node, and only then
compacted it. That document cost about 5.4 KiB per part. It also set the
process's peak RSS, and build_runtime_snapshot capped it at 20,000 nodes, so
larger places failed at startup with "world snapshot exceeds 20000 nodes".
#What changed
WorldView::for_each_snapshot_nodeandWorldView::snapshot_header(client-coreworld.rs) produce theto_snapshotnodes one at a time, in the same order.build_runtime_snapshot_from_view(client-coreruntime_snapshot.rs) runs the same per-node validation and normalization asbuild_runtime_snapshot. Both builders now share oneNodeBuilder. Areducecallback runs on each finished node before the next one is produced. The node limit is the received store's own limit (400,000).type_catalogs: falseleaves outclass_eventsandclass_property_types, which only the legacy C++ host reads andcompact_snapshotalready removed for the Rust host.live_runtime::shared_startup_snapshotstreams the startup snapshot and drops the shared property sections from each node as it is built.LiveRuntimeandrove replay-streamuse it.compact_snapshotstill runs against the projected view. It now rejects a pre-compacted node that the view can't resolve, so an early strip can never silently lose properties.
The whole-document build_runtime_snapshot, including its 20,000-node cap, is
unchanged for offline rove replay and the existing callers.
#Measured
rust-client/examples/memory_bench.rs builds a world of N parts through ordered
create deltas, as live reception does (each part has 9 properties, with 100
parts per Folder). It then projects the world, initializes the host and runs a
script that walks every descendant. ROVE_BENCH_DOCUMENT=1 selects the old
document path.
bin/cargo build --release --locked --manifest-path rust-client/Cargo.toml --example memory_bench
/usr/bin/time -l rust-client/target/release/examples/memory_bench 50000 script.luau| parts | path | startup-snapshot RSS | peak footprint |
|---|---|---|---|
| 15,000 | document | 96.7 MiB | 103.9 MiB |
| 15,000 | stream | 37.2 MiB | 38.5 MiB |
| 50,000 | document | 276.3 MiB | 314.2 MiB |
| 50,000 | stream | 78.4 MiB | 87.5 MiB |
The 50,000-part world exceeds the old cap, so a live session would have rejected it. The document row only measures the cost of that path.
#Tests
runtime_snapshot::tests::streamed_view_snapshot_matches_document_builder_and_lifts_node_limit
checks that the streamed snapshot equals the whole-document snapshot exactly.
It also checks that the reducer sees every node, that catalogs can be left out,
that reducer errors propagate, and that a world of 20,501 nodes streams while
the document builder still rejects it.
#Nodes built from the projected view (Rust host)
The Rust host could already build every node from the projected view when the
startup snapshot's nodes array is empty, but only unit tests used that path.
shared_startup_snapshot now uses it with the Rust host:
build_runtime_snapshot_from_view_selectingkeeps only the DataModel and service-root headers, whichRuntimeDeltaNormalizer::bind_snapshot_servicesreads. Every other node is still validated and normalized, then dropped.- The snapshot carries a
_rust_view_nodesmarker.compact_snapshotverifies the kept headers against the projected view, removes the marker, emptiesnodesand returns the number of view nodes. - Other hosts keep the compact per-node headers.
This also removes a second size limit. The host rejects startup documents over 8 MiB, and with per-node headers (about 100 serialized bytes each) a live world of roughly 80,000 instances hit it ("world snapshot must be an object no larger than 8 MiB"). A 100,000-part world now starts.
Two semantic differences had to be aligned first. A received attributes
or collection_tags section without an explicit attributes_known or
collection_tags_known flag counted as complete in the header path, but as
unknown in the view path. The view path (rust_host/world.rs) now uses the
header rule.
rust-client/tests/startup_paths.rs starts the same received world both ways
and compares what a Luau probe sees in each. The probe covers full names,
classes, parents (including service roots), child order, duplicate names,
names taken from the Name property, attributes, tags, GetTagged and
LocalPlayer. It found both differences before the fix.
| parts | startup path | peak footprint, trivial script | heavy script |
|---|---|---|---|
| 50,000 | document (original) | - | 314.2 MiB |
| 50,000 | compact headers | - | 87.5 MiB |
| 50,000 | view-built nodes | 50.4 MiB | 79.8 MiB |
| 100,000 | compact headers | fails (8 MiB startup limit) | fails |
| 100,000 | view-built nodes | - | 142.3 MiB |
The "heavy" script walks and reads every descendant. Its remaining cost is the Luau instance wrappers it creates (about 580 B per instance), not startup.
#Smaller received records
Each received instance is an Arc<NodeRecord>. The record was 128 bytes, so
with the Arc header the allocation was 144 bytes and mimalloc rounded it up to
its 160-byte size class. The record is now 112 bytes, which fits the 128-byte
class:
class_nameis a thinClassName(Arc<Arc<str>>, one word) instead of a fatArc<str>. The intern pool keys class handles by their interned string's address, and they deref to thatArc<str>, which defaultNamevalues still share.- The presence flags live in the top byte of the created-sequence word
(
seq_flags). Sequences are local receipt counters, and anything above 2^56 is an explicit error instead of a truncation.
world::tests::node_record_fits_the_128_byte_allocation_class guards the
layout. packed_sequence_and_flags_are_independent_and_bounded covers the
packing and the class sharing.
At 100,000 parts, the store dropped from 57.7 to 54.3 MiB (about 35 B per instance), and peak footprint with a trivial script dropped from 83.1 to 77.9 MiB.
#Script reconciliation no longer expands every record
The host keeps untouched received instances as lazy entries (a shared record
handle plus flags). Reading a field through NodeMap::values() expands an
entry into a full Node wrapper with its own id, class, name and parent
strings, about 165 B per instance.
lifecycle::reconcile runs on every pump. To find live script ids it scanned
nodes.values() and filtered by class, which expanded every instance in the
world on the first pump. ROVE_MEMORY_DIAGNOSTICS=1 reported 101,013 of
101,013 nodes materialized after init. The scan now uses
matching_class_ids and is_live, which read class and destroyed state
straight from the lazy entry. After init, and after 20 frame-pumping
executions, 13 nodes are materialized.
lifecycle_tests::reconcile_over_projected_world_keeps_untouched_records_unmaterialized
guards this. On the old code it fails with "507 of 507" materialized.
| parts | peak footprint before | after |
|---|---|---|
| 50,000 | 50.4 MiB | 38.7 MiB |
| 100,000 | 77.9 MiB | 61.5 MiB |
(Trivial script, with the smaller records from the previous section.)
The benchmark has two new switches for this kind of hunt.
ROVE_BENCH_WORLD_ONLY=1 measures World::from_snapshot alone, before VM
init. ROVE_BENCH_REPEAT=N runs the script N times.
#Property reads no longer expand records
get_property_from_world fetched the node with NodeMap::get, so every
property read (part.Position, part.Transparency, ...) expanded and cached
a full wrapper. IsA did the same through ensure_property_scriptable
(along with eight other class-only lookups in instance_helpers, lifecycle
and service_requests), and those now use NodeMap::class_name.
NodeMap::with_node and NodeEntry::with_node hand a read-only closure the
cached Node when one exists. For an untouched received record, they build the
same Node that node() would and drop it afterwards. Writes still expand
exactly the node they change.
A 50,000-part script that sums Position.Y over every BasePart returns the
same value. It now ends at 70.2 MiB instead of 78.3 MiB, with 13 instead of
50,013 nodes materialized.
world_tests::property_reads_on_projected_records_do_not_expand_wrappers
checks values and laziness. On the old path it fails with "5 -> 205".
#Instance wrappers share the record's ID
The Luau userdata behind each Instance (InstanceHandle) kept its own String
copy of the node ID. It now holds an Arc<str> taken from
NodeMap::shared_id, which for received instances is the store's own ID
allocation. Walking 50,000 parts with GetDescendants dropped from 70.1 to
69.0 MiB, about 22 B per wrapper. The rest of the roughly 400 B per wrapper
is Luau and mlua bookkeeping: the userdata, mlua's per-userdata
Rc<RwLock<_>> box, and the weak cache table's ID-string key.
#Child lookups are no longer quadratic
NodeMap::children (used by GetChildren, FindFirstChild, WaitForChild
and member-style child access) deliberately kept no all-world index. A small
bounded cache covered a few repeated parents, and every other call scanned
the whole node order. A script that calls FindFirstChild on every
descendant was therefore quadratic: 8,000 instances took 0.99 s, and 50,000
ran past the 2-second budget.
The map now builds a compact ChildIndex (parent ID -> positions in the order
slice) after CHILD_INDEX_AFTER_SCANS (4) full scans with no mutation in
between:
- Every
&mut selfentry point (get_mut,insert,remove,prune_far,compact_destroyed,values_mut) drops it. - It records the order slice's pointer and length and rebuilds for any other slice.
- Every child it returns is re-verified with
NodeEntry::is_child, and it falls back to a scan on any mismatch. - Actor forks start without one.
The cost is about 4 bytes per live child plus one boxed key per parent (roughly 0.4 MiB at 50,000 parts), and only while scripts query children repeatedly between mutations.
| instances | FindFirstChild on every descendant, before |
after |
|---|---|---|
| 2,000 | 0.061 s | 0.003 s |
| 8,000 | 0.99 s | 0.011 s |
| 50,000 | over the 2 s budget (~40 s) | 0.071 s |
world_nodes::tests::child_index_matches_full_scans_across_mutations compares
the index with a full scan across reparenting, destruction, insertion,
removal, a different order allocation and forks.
GetDescendants grouped the whole world by parent (a temporary
HashMap<String, Vec<&str>>) on every call, so calling it once per model was
quadratic too. NodeMap::indexed_descendants builds the child index on first
use (each call was O(world) anyway) and walks only the subtree. It keeps the
same breadth-first order, no-repeat and cycle guard, synthetic
attribute-holder skipping and 400,000 cap, and it re-verifies every edge,
falling back to the old grouping on any mismatch.
world_nodes::tests::indexed_descendants_match_the_grouping_traversal compares
it with a copy of the old algorithm over cycles, destroyed nodes, skipped
subtrees, limits and a reparent.
| instances | GetDescendants on every Folder, before |
after |
|---|---|---|
| 5,000 | 0.030 s | 0.009 s |
| 20,000 | 0.349 s | 0.040 s |
| 50,000 | - | 0.107 s |
#Local instances share their constructor defaults
Instance.new copied every constructor default into the node. As
serde_json values, that is 20-45 KiB per Part: each tiny nested value
({"$vector3":[..]}, {"$enum":{..}}) is a full 11-slot BTreeMap leaf
(640 B blocks). Creating 3,000 local Parts reached 166 MiB RSS, and the
live heap held 87,175 such blocks.
NodeData.propertiesis now arust_host::property_map::PropertyMap: the node's own values plus a pointer to the class's static catalog records, with tombstones for removed defaults and copy-on-writeget_mut. It behaves exactly like the copied map: same keys, values, sorted iteration, serialization andIndexpanics.property_map::testschecks every operation against a copiedMap.Clone()still materializes a full map, so its semantics are unchanged.- The local create mutation row carries only the node's own values plus
_constructor_defaults: true. The Actor import (apply_actor_create_for_replay) rebuilds the shared defaults from it (create_row_properties). Replies and Actor status rows are expanded back to the full form (expand_create_row), so external observers see the same JSON as before. mutationsin a reply are capped at 2 MiB of serialized rows (the prefix is kept, andmutations_truncatedreports how many were dropped). Previously a script that built a few thousand local instances in one step failed the whole call with "persistent response exceeds 8 MiB". Nothing in the host replays reply mutations; Actors read them from the world effects during the step.
| 3,000 local Parts | RSS after the script | peak footprint |
|---|---|---|
| before | 166.4 MiB | >160 MiB |
| shared defaults | 93.5 MiB | 99.8 MiB |
| + compact rows | 64.9 MiB | 55.9 MiB |
Clone() keeps its full-map pipeline (pivot, scale, attachment and joint
preservation, reference remapping) and then stores the result with
PropertyMap::from_full. Values equal to the class default are not kept,
missing defaults become hidden, and to_map() is exactly the built map.
write_row_properties writes clone and Instance.new create rows as the
node's own values plus _constructor_defaults and _hidden_defaults;
create_row_properties and expand_create_row honour both.
world_tests::compact_create_rows_round_trip_constructor_defaults and
property_map::tests::from_full_round_trips_any_map_against_defaults check
the round trips with real Part defaults.
| 3,000 clones of a local Part | RSS after the script | live heap |
|---|---|---|
| before | 161.6 MiB | 67.35 MiB |
| shared defaults | 95.8 MiB | 13.18 MiB |
| + compact clone rows | 71.2 MiB | - |
#Local overrides use a small sorted map
Writing a property on a received instance (or naming and parenting a local
one) stores it in NodeData.local_overrides, which was a serde_json::Map.
That is a BTreeMap whose first leaf is a 640-byte block even for one entry.
rust_host::small_map::SmallMap keeps the entries in one sorted, exactly
sized boxed slice with the same get/insert/remove results, sorted
iteration and serialization (small_map::tests::behaves_like_a_json_map
checks each operation against Map). A Vec's first growth would reserve
four 56-byte slots (a 224-byte block) for what is usually one entry; exact
sizing makes one entry a 64-byte block plus its key, and the slice header is
16 bytes instead of 24 (small_map::tests::storage_is_exactly_sized_and_the_header_is_two_words).
one Transparency write on each of 50,000 received parts |
live heap | RSS | 640 B blocks |
|---|---|---|---|
| before | 95.3 MiB | 155 MiB | 50,257 |
| after | 75.5 MiB | 122 MiB | 255 |
Exact growth then removed the per-part 224-byte block (debug build,
Transparency written on each of 20,000 received parts: 20,008 blocks of 224
bytes became 6; live heap 36.4 to 33.3 MiB, RSS 71.6 to 63.7 MiB, about 153 B
per written part). It applies equally to attributes and revisions.
With the three maps' headers at 16 bytes and PropertyMap's hidden-key list
also a boxed slice, NodeData is 128 bytes, down from 160: 32 B less for every
written received part, local instance and clone (in the same run, 20,000
blocks moved from the 160-byte class to the 128-byte class;
world_tests::node_data_fits_the_128_byte_allocation_class). Adding a new key
reallocates the slice, which is cheap at these sizes.
After that, a write still cost 376 B per part (measured by size class against
a read-only run): the expanded host wrapper (NodeEntry::node_mut: a 128-byte
boxed Node plus its own ID, class, name and parent strings, about 180 B), the
128-byte NodeData, and the override entry and key (80 B).
#Writes keep the shared record plus an overlay
A write that changes no header field (anything but Name and Parent, from a
script or from engine feedback) no longer expands the wrapper. The entry's
8-byte slot (world_node_entry::Slot) holds empty, a boxed full Node, or,
with its low bit set, a boxed NodeData overlay over the still-shared record,
so the entry stays 32 bytes in a 48-byte Rc block. NodeMap::data_mut gives
the overlay to set_property, set_engine_property and bump_local_revision
with the same cache bookkeeping as get_mut.
Readers:
- Header reads (ID, class, name, parent, flags) use the shared record.
with_node(and soget_property) copies the overlay into its temporaryNode;has_tag,attributeandlocal_revisionread it in place.NodeMap::is_materializedanswers "does this node have local state" without expanding;stub_cannot_have_property, pathfinding and joint reads use it instead ofpeek(..).is_some().- Anything that needs a
&Node(get,peek,materialized_values) expands the overlay into a full wrapper first, moving the sameNodeDatabox, so no walk over local state can miss it.prune_farskips overlays (they hold writes, so they are never pristine) without expanding them.
world_tests::writes_on_received_records_keep_the_shared_record_plus_an_overlay
writes, reads back and writes again from reads on 50 parts (all stay
overlays), checks that a copied map (an Actor fork) writes its own overlay,
that peek expands one with its data intact and with identical reads, and that
a Name write still expands.
| 20,000 received parts, debug build | per written part | 128 B blocks | 8 B blocks |
|---|---|---|---|
| full wrapper per write | 376 B | 60,276 | 64,540 |
| overlay | 208 B | 40,276 | 3,540 |
208 B is the 128-byte NodeData, the 64-byte override entry and its 16-byte
key. Writing, reading back and writing again keeps the same numbers. Reading a
written part takes about the same time as reading an untouched one (8.8 us
against 10.4 us per read in the debug build). At 50,000 parts a write on every
part adds 10.9 MiB of live heap (47.6 to 58.5 MiB); full wrappers at 376 B per
part would add about 17.9 MiB (calculated, not measured at this size).
NodeData.revisions (per-property wire revisions) is now a SmallMap<u64>
(24 bytes inline) instead of a HashMap (48). That takes NodeData from 184
to 160 bytes, out of the 192-byte allocation class: 32 B less per written or
local instance (calculated from the size classes, not separately measured).
world_tests::node_data_fits_the_160_byte_allocation_class guards it.
NodeData.attributes (attributes set locally or on materialized instances)
is now a SmallMap too. Before the change, one SetAttribute on each of
3,000 local Folders added 5.05 MiB of live heap (about 1.7 KB per instance,
two extra 640-byte blocks each). The same one-entry map change cut
local_overrides from a 640-byte leaf to about 80 bytes; the after-number
for attributes was not measured because the disk was nearly full.
HashMap iteration order was arbitrary; the sorted map is deterministic.
Moving parts kept expanding them until four readers on the CFrame path were
changed to read without caching a wrapper: pivots::live (now
NodeMap::is_live), owned_part_transform::prepare and the pose-batch
validation in apply_pose_command (now with_node), and
compact_node_if_needed, which checks the local data in place
(NodeMap::local_data_matches, given a plain fn so it cannot reach the
map). Pose, scale and curve writes use data_mut. The overlay test also moves
two parts (CFrame, Position, rotated CFrame) and checks every alias read
and that no overlay was expanded.
Each moved part still keeps about 4.3 KB (2,000 parts, one CFrame write each,
measured as allocator used_bytes three steps later: 4.51 to 12.75 MiB). Almost
all of it is the four transform overrides the pose path stores (CFrame,
Position, Orientation, Rotation; movement::part_fields): every nested
JSON object ({"$cframe":{..}}, {"$vector3":[..]}) is a 640-byte BTreeMap
leaf, five per part. The three aliases can be derived from CFrame on read
(part_transform_aliases::alias already does), but the pose rows and several
readers of local_overrides expect them stored, so dropping them needs those
readers checked first. The allocator also kept about 13 MiB more committed than
used after the move (freed pose rows sharing pages with live overrides).
#Destroy no longer scans the world
hierarchy_events::prepare (run for every Destroy and reparent) grouped the
whole world by parent to find the affected subtree. It now asks
World::live_children, which is NodeMap::children over the receipt order
and so the child index.
The index also no longer drops on every get_mut/remove. It journals up
to 256 mutated IDs, and child queries re-check those individually: a stale
edge is skipped, and a record that gained this parent is inserted at its
order position. Inserts, pruning and order changes still rebuild it.
GetDescendants rebuilds when anything is dirty.
| world size | 1,500 Destroy calls, before |
after |
|---|---|---|
| 1,000 | 0.21 s | 0.044 s |
| 4,000 | 0.60 s | 0.054 s |
| 16,000 | over the 2 s budget | 0.143 s |
| 50,000 | over the 2 s budget | 0.399 s |
The rest of the per-Destroy cost was material_history::capture. It
alternates first_live_id_of_class("MaterialVariant") and
("MaterialService") against a single-entry class cache that every
get_mut/insert also cleared, so each call scanned the world. The cache
now keeps up to 8 classes and a mutation forgets only the touched node's
class (world_nodes::tests::class_cache_holds_several_classes_and_forgets_only_the_touched_class).
1,500 destroys in a 50,000-instance world went from 0.399 s to 0.080 s
(16,000: 0.032 s). 3,000 local creates take 0.025 s at both 1,000 and 50,000
instances.
print/warn looked up every LogService with of_class, a scan of the
whole world per call: 2,000 prints took 0.565 s at 50,000 instances
(0.017 s at 1,000). NodeMap::class_ids caches the IDs of a class with the
same class-scoped invalidation and is now used for LogService, and for the
Player and Terrain scans in movement (inside an ancestry walk) and
instance_helpers. 2,000 prints now take 0.0075 s at 50,000 instances.
Every pump also scanned the world twice. lifecycle::reconcile listed
Script/LocalScript IDs with matching_class, and actors::step_with_received
walked the receipt order looking for Actors. Reconcile now uses
NodeMap::class_ids_any, which keeps the same interleaved table order as the
scan and is cached until a node of those classes changes or anything is
inserted or removed (a rehash can reorder the table). The Actor walk is
skipped when the cached Actor list is empty. actors::has_planned_vm
(also once per pump) uses the same cached Actor list instead of scanning
every record for the class.
| instances | per-pump overhead, before | after |
|---|---|---|
| 1,000 | ~0.03 ms | 0.033 ms |
| 20,000 | ~1.2 ms | 0.043 ms |
| 50,000 | ~4.6 ms | 0.094 ms |
instance_cache_table (run by every instance() call, cache hits included)
no longer sweeps dead-world buckets on a hit; it sweeps only when it creates
a cache. A hit also checks that its world is still alive, because a dead
world's address can be reused by a new one. Wrapping 808,000 instances
(40 GetDescendants over 20,000 parts) takes about 0.7 us per instance.
humanoid_health::protected (each TakeDamage and each received Health
change) walked every instance looking for ForceFields; it now checks the
cached class_ids("ForceField") with the same live-parent rule.
#Zero-JSON packed binary reads, 24-byte host entries, and steady-state fast paths
- Lossless 53-bit
f64CFramepacking & eager wire create packing:PackedPropertiesnow encodes$cframepayloads with fullf64positions and compact/identity/quaternion rotations directly inTypedBytes(instead of spilling toOverflowProperties+ zstd), adds contiguous 8-byteu64key prefixes onPropertyShape, and shrinks per-threadDecodedPathCacheto 32 entries / 64 KiB.replication::new_instanceeagerly packs multi-property creates (>= 96 B) intoArc<PackedProperties>and avoids intermediatejson!deep-clones;RuntimeDeltaNormalizerandProjectionContextshareClassPropertyTypeIndexandServiceRootsMapviaArcwithout per-delta map clones. - 24-byte
NodeEntry& sharednode_orderArc<str>handles: Packing all entry flags intoworld_node_entry::SlotshrinksNodeEntryfrom 32 B to 24 B (Rc<NodeEntry>mimalloc class 48 B -> 40 B), andWorld::from_snapshotreusesReadOnlyNode::shared_id()+bootstrap_projected_stub, eliminating 100,000 duplicateArc<str>s at 100,000 parts. Despawn/removal paths acrossWorldStore,NodeMap,instance_state::Receiver,Mailbox, andSchedulershrink excess capacity back down viashrink_to. - Zero-JSON typed property reads (
ReadOnlyNode->ProjectedNode-> Luau):ReadOnlyNodeandProjectedNodeexpose direct binary slice decoders (property_bool,property_i64,property_f64,property_str,property_cow_str,property_vec2,property_vec3,property_color3,property_cframe,projected_position_vec3,projected_size_vec3,projected_cframe,metadata_u64).InstanceHandle::__indexfilters class-scopedAttachmentandInputObjectkeyed getters inO(1)and decodes untouchedBasePartproperties straight fromTypedBytesintomlua::Valueacross both direct and deferred hook paths with zeroNodewrappers and zeroserde_json::Valueallocations. - Catalogs, spatial broadphase, 60Hz physics/GUI, and pump skips:
runtime_sourcesandengine_classescache pinned class/player-script catalogs inOnceLockand.rodataslices;geometryrejects non-overlapping parts via world-space AABB / ray-slab broadphase before ancestor walks or narrowphase;LivePhysicsSimulatorsharesArc<[Aabb]>colliders across 60Hz substeps;guiuses stack layout structs + reusableLayoutScratch; andscheduler,lifecycle::reconcile, andactorsskip unchanged frames inO(1).
#Overall, 50,000 and 100,000 received parts
Peak memory footprint, maximum RSS, and CPU timings measured on macOS arm64
(--release). "Trivial" returns #workspace:GetChildren(); "folder walk"
iterates workspace:GetChildren() -> folder:GetChildren() and sums
part.Position.X across every part (100 handles live per folder); "hello.luau"
evaluates #workspace:GetDescendants(); "heavy walk" walks
workspace:GetDescendants() and sums part.Position.X over every BasePart.
| parts | stage / workload | peak footprint | max RSS | Luau walk CPU | process real (user + sys) |
|---|---|---|---|---|---|
| 50,000 | original whole-document start (heavy) | 314.2 MiB | - | - | - |
| 50,000 | streamed per-node headers (heavy) | 87.5 MiB | - | - | - |
| 50,000 | view-built nodes (heavy / trivial) | 79.8 / 50.4 MiB | - | - | - |
| 50,000 | lazy property reads + shared IDs (heavy / trivial) | 67.7 / 38.7 MiB | - | - | - |
| 50,000 | Wave 8: trivial (#workspace:GetChildren()) |
33.3 MiB | 43.5 MiB | - | 0.33 s (0.25 + 0.06 s) |
| 50,000 | Wave 8: folder walk (50k Position.X reads) |
35.4 MiB | 45.5 MiB | 0.056 s | 0.35 s (0.29 + 0.05 s) |
| 50,000 | Wave 8: examples/hello.luau (#GetDescendants()) |
53.6 MiB | 64.0 MiB | - | 0.68 s (0.29 + 0.06 s) |
| 50,000 | Wave 8: heavy walk (GetDescendants + 50k Position.X) |
52.4 MiB | 62.5 MiB | 0.066 s | 0.55 s (0.36 + 0.09 s) |
| 100,000 | pre-Wave 8 view-built nodes (heavy / trivial) | 142.3 / 61.5 MiB | - | - | - |
| 100,000 | Wave 8: trivial (#workspace:GetChildren()) |
52.2 MiB | 62.3 MiB | - | 0.66 s (0.53 + 0.12 s) |
| 100,000 | Wave 8: folder walk (100k Position.X reads) |
55.6 MiB | 65.8 MiB | 0.123 s | 0.83 s (0.68 + 0.13 s) |
| 100,000 | Wave 8: examples/hello.luau (#GetDescendants()) |
91.0 MiB | 101.4 MiB | - | 0.79 s (0.64 + 0.14 s) |
| 100,000 | Wave 8: heavy walk (GetDescendants + 100k Position.X) |
91.3 MiB | 101.4 MiB | 0.159 s | 1.02 s (0.79 + 0.19 s) |
At 100,000 parts (101,001 nodes), the received WorldStore stage is 47.8 MiB
(333 B/node, down from 57.7 -> 54.3 MiB), and reading Position.X across all
100,000 parts adds only 0.3 MiB over holding the GetDescendants() handle table.
#Still open
- Instance wrappers (about 228 B of Luau heap each, plus mlua's 48 B box).
Measured with 20,201 live handles: the weak cache costs about 125 B of Luau
heap per handle (removing the insert cut 6,050 to 3,580 KiB), mostly the
interned ID-string key and its hash slot.
Plan: give every node a small stable integer handle (a
u32slot thatNodeMaphands out and never reuses while any wrapper for that node could exist), key the cache by that integer, and store the integer instead of theArc<str>inInstanceHandle. Identity stays per ID, because a slot maps to exactly one ID for the node's lifetime and destroy/recreate keeps the ID's slot. Expected saving is about 60-80 B per wrapper. It needs a test that a wrapper obtained before and after a destroy/recreate of the same ID stays==, as today. - Failed member lookups (about 50 us against 1.4 us for a hit). More than
half is Luau's C++ exception throw and unwinding. Plan: answer common
misses without throwing where Roblox semantics allow it (for example
FindFirstChild-style paths that already return nil). Keep the error path itself unchanged, since switching Luau tolongjmpchanges how errors cross mlua's Rust frames and needs its own review. - Pose writes per step. Every
CFramewrite appends a fullsetmutation row (about 500 B) to the step's effects. More than 16,384 of them in one non-yielding step fails with "pose mutation row limit exceeded" (for example 2,000 parts moved 10 times in one loop), and memory grows about 40 MiB per 80,000 writes until the step ends. ACFramewrite also costs about 15 us against about 2 us forTransparency/Size(flat in world size). Plan: coalesce repeatedsetrows for the same ID and property that come after every consumer's cursor. Actor sync reads rows by position during the step (actor_shadow,mutation_cursors), so rows already consumed must not be rewritten. Then raise or remove the limit. Coalescing is harder than it looks. Several in-step readers depend on row positions: movement intents record amutation_cursor, MaterialService edits rows after a saved cursor, humanoid health tags the last row, and curves count rows. Removing a row shifts every later cursor, and updating an earlier row in place moves a later value before cursors recorded after it. A fix needs those readers to switch to stable row sequence numbers first. A CPU sample of the write itself (movement::set_part_transform) puts about 35% inpivots::bulk_move::commit. Another part is reading the received transform when overflow zstd blocks are present:PackedProperties::getdecompresses its shared zstd payload whenever it missesDecodedPathCache. That cache is deliberately bounded (32 entries, 64 KiB), so moving thousands of distinct overflow-backed parts per frame trades CPU for that fixed RAM ceiling.
This page is startup-memory.md in the Rove repository.