question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PoolVectorArray3 filling super slow?

See original GitHub issue

Hello,

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:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
chippmanncommented, Jul 14, 2022

@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?

0reactions
richardtreiercommented, Jul 14, 2022

I haven’t exactly run the tests again. If the issue with resize prevails I shall open another detailed one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 Reasons Why Your Toilet Is Slow to Fill - Mr. Rooter Plumbing
In this article, we'll explain three common causes of a slow-filling toilet, how to troubleshoot the problem, and the steps you can take...
Read more >
Filling tank - super slow? - Form 3L - Formlabs Forum
Hi, Is it supposed to fill the tank super slow, the stream of resin is about 1 mm in diameter., I emptied one...
Read more >
How to Fix a Slow Filling Toilet After Flushing | John C. Flood
Is your toilet slow to fill? Learn how to troubleshoot and fix the problem here. Contact the plumbing experts at John C. Flood...
Read more >
How to Fix a Slow-Filling Toilet - Lowe's
A man opening the water supply valve. Depending on your water pressure, a tank usually refills in about three minutes. If it's slow...
Read more >
4 Reasons Why Your Toilet Is Slow to Fill | Rick's Plumbing
Clogs and issues with slow filling toilets are common, but they don't have ... Is your toilet water taking too long to fill...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found