Quick answer: Godot 4 C# Godot.Collections.Array significantly slower than System.Array for in-game data? Godot collections marshal at every access; use System for hot paths.

Inventory access in tight loop: Godot.Collections.Array iteration is 10x slower than List<T>.

Use List<T> internally

For hot paths, System collections. Convert to Godot.Collections at the engine boundary.

Or batch Godot.Collections access

Read once into a System list; operate; write back. One marshalling cost.

Profile per access

Per-call marshalling cost visible. Hotspots = candidates for migration.

“Cross-language interop has cost. Hot paths pay disproportionately.”

Establish the convention: 'System types in code; Godot types at engine boundary'. Performance follows.

Related reading