Document the upsides and downsides of packed arrays versus typed arrays

This commit is contained in:
Hugo Locurcio 2023-06-15 07:56:52 +02:00
parent 59457685c1
commit ab8c9b678f
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
7 changed files with 7 additions and 0 deletions

View file

@ -11,6 +11,7 @@
var string = " ".join(string_array)
print(string) # "hello world"
[/codeblock]
[b]Differences between packed arrays, typed arrays, and untyped arrays:[/b] Packed arrays are generally faster to iterate on and modify compared to a typed array of the same type (e.g. [PackedStringArray] versus [code]Array[String][/code]). Also, packed arrays consume less memory. As a downside, packed arrays are less flexible as they don't offer as many convenience methods such as [method Array.map]. Typed arrays are in turn faster to iterate on and modify than untyped arrays.
</description>
<tutorials>
<link title="OS Test Demo">https://godotengine.org/asset-library/asset/677</link>