SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Pass `ReducerContext` earlier by reference

Open Centril opened this issue 10 months ago • 0 comments

We pass the ctx: ReducerContext by move in __call_reducer__ and in a few hops before we actually reach reducer.invoke(&ctx, args) where it's finally passed by reference. However, size_of_val(&ctx) is 400, mainly due to rng, so this will likely result in memcpy rather than passing in registers. Avoid this by immediately passing ctx by reference in __call_reducer__.

Centril avatar Feb 24 '25 10:02 Centril