clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.17k stars 102 forks source link

Some clarifications to dropping the updates in eval incr #1192

Closed Centril closed 1 month ago

Centril commented 1 month ago

Description of Changes

Based on the latest flame-graph, we are spending notable time doing drop_in_place of the iterators of IncrementalJoin::eval. At first, I thought this was because we were cloning and dropping 4x the SmallVec, but as these are inline and not heap allocated, that seems unlikely. So this PR tries to clarify in code that this isn't the case by using ArrayVec and borrows. Moreover, all the dropping work of the hash map is moved outside the rayon parallel iteration. Also, this makes the benchmarks slightly more accurate as they now do not clone-allocate + drop in place.

API and ABI breaking changes

None

Expected complexity level and risk

1