Bug 23432 – document when array capacity is zero and capacity performance

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2022-10-23T17:59:35Z
Last change time
2022-10-26T09:56:27Z
Keywords
pull
Assigned to
No Owner
Creator
Nick Treleaven

Comments

Comment #0 by nick — 2022-10-23T17:59:35Z
The spec should document that reducing array length will set capacity to zero. (This was already reported as an invalid issue #11561). The spec should warn that capacity needs a global lock and table lookup. PR incoming.
Comment #1 by dlang-bot — 2022-10-23T18:02:32Z
@ntrel created dlang/dlang.org pull request #3445 "[spec/arrays] Improve capacity docs" fixing this issue: - [arrays] Improve capacity docs Remove sentence about appending to a static array. Add note about static array capacity being for generic code. Mention capacity is zero if not pointing to GC (array) memory. Extend example and explain it afterwards. Explain when array length is reduced, capacity will be zero. Mention performance impact of capacity. Fix Issue 23432 - document when array capacity is zero and capacity performance. https://github.com/dlang/dlang.org/pull/3445
Comment #2 by dlang-bot — 2022-10-26T09:56:27Z
dlang/dlang.org pull request #3445 "[spec/arrays] Improve capacity docs" was merged into master: - 585eb902ccb3dbd772882d9cb6f029d477c5c93f by Nick Treleaven: [arrays] Improve capacity docs Remove sentence about appending to a static array. Add note about static array capacity being for generic code. Mention capacity is zero if not pointing to GC (array) memory. Extend example and explain it afterwards. Explain when array length is reduced, capacity will be zero. Mention performance impact of capacity. Fix Issue 23432 - document when array capacity is zero and capacity performance. https://github.com/dlang/dlang.org/pull/3445