warp icon indicating copy to clipboard operation
warp copied to clipboard

[REQ] Expose Fast Paths for Constructing Types

Open christophercrouzet opened this issue 6 months ago • 0 comments

Description

Constructing types at the Python scope like wp.vec3, wp.mat22, wp.transform, and others, can be slower than expected due to accommodating various input types, so fast and explicit alternatives should be provided such as:

def matrix_from_values(*args: Sequence[float]): ...
def matrix_from_cols(*args: Sequence[wp.vec]): ...
def matrix_from_rows(*args: Sequence[wp.vec]): ...
def matrix_from_numpy(arr: np.array): ...
def matrix_from_sequence(arr: Sequence[float): ...
def matrix_from_scalar(scalar: float): ...

Additionally, the documentation should be updated to reflect possible performance issues with the default __init__ constructors and suggesting these alternatives.

christophercrouzet avatar Oct 09 '25 01:10 christophercrouzet