perf(cellular): share current fields and advance session batches in place
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 1m9s
Foundation / server-image (push) Successful in 4m17s
Foundation / image (push) Successful in 4m41s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 1m9s
Foundation / server-image (push) Successful in 4m17s
Foundation / image (push) Successful in 4m41s
DEV region 10 ran at about one tick per second. Every owner restore regenerated the region's current field (about 19 ms of a 29 ms restore for 60 x 60 mm), and the server restores several times per tick: the session batch builder copies the committed state, copied it again for each appended tick, and publication replays from another copy. On the slower worker node that capped the region far below 20 ticks per second, which also left the client's view stale, so it sent no movement. Generated fields are now shared per process (they are immutable and fully determined by their configuration): a 60 x 60 mm restore with 3,500 deposits drops from 29 ms to 1.5 ms. The builder advances its private working state in place when a tick has no births, after checking the batch and mutation-action encodings first; a refused owner tick leaves it unchanged, so appends stay all-or-nothing. Births keep the copying path. Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
@@ -44,6 +45,11 @@ class CellularFlowField {
|
||||
public:
|
||||
[[nodiscard]] static std::expected<CellularFlowField, CellularCurrentError>
|
||||
generate(const CellularCurrentConfig& config);
|
||||
// The same field, generated once per process and shared: fields are immutable and fully
|
||||
// determined by their configuration, and restoring an owner must not regenerate one.
|
||||
[[nodiscard]] static std::expected<std::shared_ptr<const CellularFlowField>,
|
||||
CellularCurrentError>
|
||||
shared(const CellularCurrentConfig& config);
|
||||
// Liquid velocity at a point, clamped into the region; bilinear between grid nodes.
|
||||
[[nodiscard]] CellularFlowSample sample(std::int64_t x_um, std::int64_t y_um) const noexcept;
|
||||
// At the centre of a square footprint whose lower-left corner is `position`.
|
||||
|
||||
Reference in New Issue
Block a user