-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arrow deser: Add zero-copy happy path #3109
Comments
Similarly, enum CollectionOpt<T> {
/// Missing => all `None`
Empty { num_instances: usize }
/// No nulls
Dense(DataCell),
Collected(Vec<Option<T>>),
} this would greatly optimize the happy-path of e.g. color deserialization (happy = no nulls), |
We should definitely do this, but the bulk of the slowdown from colors is still from the usage of the joining iterator, rather than identifying that points and colors both have the same instance-ids and going direct to the native iterator. |
Right you are! Here's Zero-copy deser would shave off ~4ms of Here's the related issue: |
Here's the latest flamegraph of what happens in wasm (serial): Positions are collected twice before being sent to the gpu, but we don't need to For radii we construct an For colors we currently collect a The instance keys are collected twice. We can save 0.5 ms there. Conservatively counting that is at least another 50% speedup for wasm with this simple optimization. |
At this point I would hold off on this until we're done migrating to |
@teh-cmc is this basically done now? |
Hmm yeah, I guess so. There's still a lot of cleanup I want to do regarding the code generated for deserialization (for the few cases where we still rely on it), but that's somewhat orthogonal to this. |
Currently
process_arch_view
incrates/re_space_view_spatial/src/parts/points3d.rs
will bottom-out inLoggable::try_iter_from_arrow
which returns an iterator. We should be able to return slices to the underlying arrow buffer instead (zero-copy) for simple things like positions, radii, colors, etc.Complex things (e.g.
struct
) we cannot do this, because Arrow is SoA and we want AoS.We should consider replacing
try_iter_from_arrow
with:For the happy-path, the codegen will generate return a slice. For other cases it would iterate and collect, and return the
Vec
.This makes the calling code very simple, and the happy path very fast.
The unhappy path is not slower - we need to do a collect at some point anyway.
The text was updated successfully, but these errors were encountered: