Repository navigation
ecs 0.6.0, ecs-persistence 0.2.0: save, restore and watch values a trait covers on any thread - #284
Merged
Merged
Conversation
…ait covers on any thread (#283) - World-thread commands, spawns and spawnTables give joined threads' data objects values, delivered by message and applied at the sync point through the move log. - spawnTables rewrites entity values in the resources it sets, and refuses only a resource a joined thread fills that isn't data. - Readonly systems' tables gather the values joined threads hold, merged by entity. - Readonly systems may filter on traits: changed: [trait] runs them once something declaring the trait changed, on any thread. - ecs-persistence: snapshot and spawn cover values on any thread; watch({ world, by }, onChange); guide chapter 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #283.
@adobe/ecs-persistencenow saves, restores and watches every value a trait covers, on whichever thread holds it.@adobe/ecs 0.6.0
commands.spawnTableson the world's thread may give data (a type with a schema, nottransfer) to an object a joined thread holds. The value goes there by message and is set at the sync point through the move log. Replay waits for a message that hasn't arrived, and the world never waits for delivery. Values that aren't data are still refused.spawnTablesfixes: it rewrites entity values in the resources it sets, and refuses only a resource a joined thread holds that isn't data, not every resource declared on another thread.tablesfrom other threads: a readonly system'stablesasks each joined thread for the values it holds and merges them by entity. Objects of other threads no longer place atablessystem on that thread.System.create({ readonly: true, changed: [trait] }, ...)runs only once something declaring the trait changed, on any thread: a write, an add or remove, or a spawn or despawn. It runs only on the world's thread; a joined thread's own system that declares it is refused.CLAUDE.mdnow states that the core is minimal and performance-first.@adobe/ecs-persistence 0.2.0
snapshotandspawncover values on any thread.watch({ world, by }, onChange), which returns a function that stops it.Tests and performance
tablesreads from other threads, the trait filter, and rewriting entity values in resources;*.tsbuildinfo:check:workspaceandbuildpass, and every package's tests pass. Three tests timed out under load and passed when rerun alone.pnpm perf: all 188 node benchmarks were compared with a run on unchanged code. The differences stay within the spread of repeated runs on unchanged code, so no regression. New benchmarks:trait notice quiet 100Kcosts 347 ns per run with nothing changed, andtrait notice written 100Kmeasures a run that writes one row of a component declaring the trait.perf/history: the machine was too busy for a reliable one. Record on an idle machine before merging.