Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add performance note to Array.resize() #84666

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading