Vector3iVector is 1000 times slower if provided with int64
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### Proposed new feature or change
Vector3iVector is 1000 times slower if we provide an int64 array instead of an int32 which has a huge impact when casting or manipulating meshes if we're not careful. Automatically casting to int32, forbidding int64 or a warning message would help and prevent this from happening.
### References
_No response_
### Additional information
Example:
```
import trimesh
import open3d as o3d
import numpy as np
print(o3d.__version__)
mesh = trimesh.primitives.Sphere(radius=1, center=[0,0,0], subdivisions=8)
vertices = mesh.vertices.copy()
faces64 = mesh.faces.copy()
faces32 = faces64.astype(np.int32)
print(f"\nVertices {vertices.dtype}")
%time _ = o3d.utility.Vector3dVector(vertices)
print(f"\nFaces {faces64.dtype}")
%time _ = o3d.utility.Vector3iVector(faces64)
print(f"\nFaces {faces32.dtype}")
%time _ = o3d.utility.Vector3iVector(faces32)
```
Output:
```
0.16.1+1c84344a
Vertices float64
CPU times: user 22.6 ms, sys: 5.39 ms, total: 28 ms
Wall time: 1.74 ms
Faces int64
CPU times: user 1.42 s, sys: 313 ms, total: 1.73 s
Wall time: 1.37 s
Faces int32
CPU times: user 1.12 ms, sys: 268 µs, total: 1.39 ms
Wall time: 1.4 ms
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.