Skip to content

Conversation

@dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Dec 5, 2025

It's frequently surprising to folks that accessing individual elements on a Packed*Array can be inefficient from godot-cpp.

This attempts to explain, and provide the advice to use ptr() or ptrw() instead!

@dsnopek dsnopek requested a review from Ivorforce December 5, 2025 21:50
@dsnopek dsnopek force-pushed the godot-cpp-packedarrays-ptr branch 2 times, most recently from 9dfb524 to 4788781 Compare December 5, 2025 21:52
@dsnopek dsnopek requested a review from paddy-exe December 5, 2025 21:54
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and i agree this is something Godot-cpp users should be aware of. The same kind of access is also slow in Godot, but it's especially slow in godot-cpp.

@dsnopek dsnopek force-pushed the godot-cpp-packedarrays-ptr branch from 4788781 to 062e1bd Compare December 7, 2025 11:41
Copy link
Contributor

@paddy-exe paddy-exe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well :) Appreciate you adding an example as well with bad and good version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants