-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Provide a means to control the underlying header storage capacity. #1451
Conversation
Can one of the admins verify this patch? |
8 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
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.
thank you! lgtm
@swift-nio-bot add to whitelist |
Motivation: It's not always possible to initialize `HTTPHeaders` with all the headers one needs to set. In such case, the underlying array will be expanded as and when needed upon headers being appended. `Array` provides the means to reserve capacity to optimize such use case. This PR exposes this functionality in `HTTPHeaders`. Modifications: Expose method `reserveCapacity(_ minimumCapacity: Int)` and computed variable `capacity: Int` in `HTTPHeaders` and added some tests. Result: Developers will be able to control the capacity of the underlying headers array as such: ``` var headers = HTTPHeaders() headers.reserveCapacity(5) ```
4d8ebf2
to
82ff701
Compare
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.
LGTM. ✨
…pple#1451) Motivation: It's not always possible to initialize `HTTPHeaders` with all the headers one needs to set. In such case, the underlying array will be expanded as and when needed upon headers being appended. `Array` provides the means to reserve capacity to optimize such use case. This PR exposes this functionality in `HTTPHeaders`. Modifications: Expose method `reserveCapacity(_ minimumCapacity: Int)` and computed variable `capacity: Int` in `HTTPHeaders` and added some tests. Result: Developers will be able to control the capacity of the underlying headers array as such: ``` var headers = HTTPHeaders() headers.reserveCapacity(5) ``` Co-authored-by: Ludovic Dewailly <ldewailly@apple.com>
Motivation:
It's not always possible to initialize
HTTPHeaders
with all the headers one needs to set. In such case, the underlying array will be expanded as and when needed upon headers being appended.Array
provides the means to reserve capacity to optimize such use case. This PR exposes this functionality inHTTPHeaders
.Modifications:
Exposed method
reserveCapacity(_ minimumCapacity: Int)
and computed variablecapacity: Int
inHTTPHeaders
and added some tests.Result:
Developers will be able to control the capacity of the underlying headers array as such: