Skip to content

Improve descriptions of LocalVector, recommend it when appropriate #11142

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beicause
Copy link

The current documentation doesn't highlight the advantages of LocalVector and may lead to misunderstandings and discourage its use.
In fact I rarely noticed the differences between LocalVector and Vector before, until seeing many PRs in 4.5 replacing Vector with LocalVector. I think we should provide a clearer explanation of LocalVector in the documentation.

@skyace65 skyace65 added enhancement area:contributing Issues and PRs related to the Contributing/Development section of the documentation labels Jul 25, 2025
@smix8
Copy link
Contributor

smix8 commented Jul 27, 2025

The main benefit of LocalVector, apart from no copy-on-write, is that a LocalVector keeps its allocated memory. So when you frequently edit and clear stuff and it is used internally only you want to use a LocalVector to not waste performance on all the frequent memory alloc.

@beicause
Copy link
Author

The main benefit of LocalVector, apart from no copy-on-write, is that a LocalVector keeps its allocated memory. So when you frequently edit and clear stuff and it is used internally only you want to use a LocalVector to not waste performance on all the frequent memory alloc.

Will this be changed? Related: godotengine/godot#105928 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:contributing Issues and PRs related to the Contributing/Development section of the documentation enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants