Batches the quat to vec, rotation, and mat compose functions for upst…#108
Batches the quat to vec, rotation, and mat compose functions for upst…#108apasarkar wants to merge 4 commits into
Conversation
…ream use in graphics libraries
|
Thanks for this contribution! Some general comments:
|
|
Sounds good, thanks @almarklein To address the comments:
Code for profiling compose_mat: The relative runtimes here are: So mat_compose looks good w.r.t. overheads observable at n = 1. Did a similar expt for the quat_to_vec code: Each call takes ~0.1 ms, so the before/after didn't really change with the batching logic it seems. |
|
I think in particular we are eager to see a comparison with the implementation on the main branch :) to avoid a potential performance regression |
|
Hi @Korijn! The comparison above is w.r.t. the code on the main branch. (I cut/pasted the code on main right now and compared that with the new batched code). |
|
So then do I correctly understand that the n=1 case became 3x slower? It's on the hot path for pygfx if I am not mistaken, can you address this? E.g. the explicit float typecast in asarray is some overhead you can potentially do without... There's more ways to get it done |
This PR allows for faster vectorized computations of some key functions that are regularly used in fastplotlib. Specifically, the functionality to go from vectors --> quaternions and the function to compose a transformation matrix from translation vectors/quaternions/scaling offsets is updated.
Edit: also includes updated tests for checking that batching works.