Skip to content

Commit

Permalink
Add performance note to Array.resize()
Browse files Browse the repository at this point in the history
  • Loading branch information
MewPurPur committed Nov 9, 2023
1 parent b733901 commit 80b6360
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
<param index="0" name="size" type="int" />
<description>
Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are [code]null[/code]. Returns [constant OK] on success, or one of the other [enum Error] values if the operation failed.
Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
[b]Note:[/b] This method acts in-place and doesn't return a modified array.
</description>
</method>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedByteArray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedColorArray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedFloat32Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedFloat64Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedInt32Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedInt64Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedStringArray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedVector2Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PackedVector3Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<return type="int" />
<param index="0" name="new_size" type="int" />
<description>
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
</description>
</method>
<method name="reverse">
Expand Down

0 comments on commit 80b6360

Please sign in to comment.