Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changing AcceptedCommands Interface #37646
base: master
Are you sure you want to change the base?
Changing AcceptedCommands Interface #37646
Changes from 24 commits
a6c102c
60c855f
97a16db
0aeb4e5
c9918d2
9685fee
1e118db
3a551c1
ff54464
6511c42
77a4f9f
7cb4b5e
dde4481
e55e237
5a0a934
62429e8
6f5ea52
319d9aa
8e92e77
777a609
5f53224
9671d96
33a0663
6e4a9e9
e4a4968
10cd5d3
731222e
98ea178
3f4a906
3037bfc
f4cdd15
7f56e9f
a20600e
afc80b1
8c10c16
2bf9949
8b8947b
316072b
9c54176
088f797
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so are the capacity bits before these calls just optimizations then? That should be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and no, Single element Append doesn't allocate and just fails, MultiAppend, aka AppendElements, does allocate as needed.
I don't like the inconsistency either, I feel is error prone, chatted with @andy31415, and will create a ticket to tech debt to figure out a better way and fix otherwise
I suggested renaming
Append
toTryAppend
for the non-allocating function and optionally adding anAppend
which does the Ensure, also optionally aTryAppendElements
for symmetry, and further optimization.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a background, we tried making the
Auto-append
clunky to encourage people to use "static arrays" instead (larger memory allocations if needed and ability to re-use pointers). In practice when things are conditional, it seems we still kind of default to "append". .... I would probably err on the side of just renaming append to TryAppend and documenting that you may not want to actually use this and prefer to call AppendElements. Or we can also completely dropAppend
from the public interface.What I want to avoid is everyone doing
Append, Append, Append
because it is convenient to write and cause many re-allocations as a result.