PoolVectorArray3 filling super slow?
See original GitHub issueHello,
while generating mesh I noticed trying to get data into PoolVector2Array
/PoolVector3Array
instances seems to be quite slow.
My scenario:
- One
MeshInstance
- One
ArrayMesh
instance created in Kotlin - 20.000 cubes
- primitive triangles, meaning 200k Faces, 600k Vertices, 600k UVs
My measurements:
- 32ms Generating Triangles and UVs
- 847ms
PoolVector2Array.append(...)
calls - 1799ms
PoolVector3Array.append(...)
calls - 16ms
addSurfaceFromArrays
call - 176ms other stuff
When I tried to see if using PoolVector3Array.resize(...)
in combination with PoolVector3Array.set(i, ...)
would be faster, it started failing as:
ERROR: Index p_index = 720216 is out of bounds (s = 0).
at: PoolVector<struct Vector3>::remove (D:\a\godot-kotlin-jvm\godot-kotlin-jvm\core/pool_vector.h:367)
ERROR: Index p_index = 0 is out of bounds (size() = 0).
at: PoolVector<struct Vector3>::set (D:\a\godot-kotlin-jvm\godot-kotlin-jvm\core/pool_vector.h:479)
ERROR: Index p_index = 1 is out of bounds (size() = 0).
at: PoolVector<struct Vector3>::set (D:\a\godot-kotlin-jvm\godot-kotlin-jvm\core/pool_vector.h:479)
ERROR: Index p_index = 2 is out of bounds (size() = 0).
[...]
When I tried to see if using PoolVector3Array.resize(...)
in combination with PoolVector3Array.insert(i, ...)
would be faster, it was actually slower at 1000ms and 2000ms for PoolVector2Array.append(...)
and PoolVector3Array.append(...)
calls respectively.
Am I missing something? Is there any way to fill PoolVector2Array
/PoolVector3Array
instances in O(1)? Will this be different with godot-kotlin for Godot 4? Is it possible to circumvent these O(n) difficulties within godot-kotlin or are they affected by APIs outside godot-kotlin’s control?
Used Version: 0.3.3-3.4.2
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
@piiertho @richardtreier Can this issue be closed? From the PR’s it seems to me that this issue is resolved? Well apart from the performance issues of course but until Godot provides another api there’s nothing we can do about it i suppose?
I haven’t exactly run the tests again. If the issue with resize prevails I shall open another detailed one.