-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[string] Skip allocation in reserveCapacity if smol #16694
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
Conversation
@swift-ci please test |
@swift-ci please smoke benchmark |
Build failed |
stdlib/public/core/StringGuts.swift
Outdated
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.
Note to self: use a spell checker. "accommodate"
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.
It allocc
but it also accommoddatt
@swift-ci please test linux platform |
Build failed |
Build failed |
Build comment file:Optimized (O)Regression (14)
Improvement (10)
No Changes (411)
Added (1)
Hardware Overview
|
Add StringBuilderSmallReservingCapacity variant to measure the excess overhead caused by calls to reserve capacity. If a string is small, and the capacity is small, this will demonstrate overhead if an allocation happens.
If the requested capacity is small enough to fit in our small string representation, don't allocate a UTF-16 buffer, instead just return early.
97a73bd
to
1fe5fb7
Compare
@swift-ci please test |
Build failed |
Build failed |
[benchmark] Add reserveCapacity String benchmark to builder.
Add StringBuilderSmallReservingCapacity variant to measure the excess
overhead caused by calls to reserve capacity. If a string is small,
and the capacity is small, this will demonstrate overhead if an
allocation happens.
[string] Skip allocation in reserveCapacity if smol
If the requested capacity is small enough to fit in our small string
representation, don't allocate a UTF-16 buffer, instead just return
early.