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

Improve sizehint! docstring about shrink arg #52226

Merged
merged 6 commits into from
Dec 11, 2023
Merged

Conversation

nalimilan
Copy link
Member

@nalimilan nalimilan added docs This change adds or pertains to documentation collections Data structures holding multiple items, e.g. sets labels Nov 18, 2023
base/array.jl Outdated Show resolved Hide resolved
base/array.jl Outdated Show resolved Hide resolved
base/array.jl Outdated Show resolved Hide resolved
@matthias314
Copy link
Contributor

Since we are talking about the docstring for sizehint!, I would like to comment on the sentence

If `first` is true, then the reserved space is from the start of the collection, for ordered
collections.

(which is not changed at present). I don't find the phrase "reserved from the start of the collection" very clear. What about the following:

If the collection is ordered and `first` is `true`, then any additional space is reserved
before the start of the collection rather than after the end. This way, subsequent calls
to `pushfirst!` (instead of `push!`) may become faster.

@nalimilan
Copy link
Member Author

I've pushed a commit to apply the proposed changes.

base/array.jl Outdated Show resolved Hide resolved
base/array.jl Outdated Show resolved Hide resolved
Co-authored-by: Petr Vana <petvana@gmail.com>
base/array.jl Outdated Show resolved Hide resolved
base/array.jl Outdated Show resolved Hide resolved
base/array.jl Outdated Show resolved Hide resolved
@nalimilan nalimilan merged commit 3accfe8 into master Dec 11, 2023
5 of 7 checks passed
@nalimilan nalimilan deleted the nl/sizehintdocs branch December 11, 2023 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Data structures holding multiple items, e.g. sets docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants