resize is slow
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- performance
Research direction
Locate circular_buffer::resize(new_size, item) and read its current resizing paths alongside erase_end(n), which the issue identifies as already optimized for scalar types. Confirm the no-reallocation scalar cases and verify that shrinking and growing meet the requested complexity improvements.
Written by the indexing model from the issue text.
Description
Hello,
Would it be possible to improve complexity of circular_buffer<T>::resize(new_size, item) in the case where T is scalar ?
Currently, complexity is always linear.
It would be nice to have constant complexity when T is a scalar type and no reallocation happens (ie. new_size <= capacity()).
When we want to reduce size of buffer (ie. new_size < size()), you could call erase_end(n) internally which already implements an optimization for scalar types.
When we want to increase size of buffer, you could optimize for scalar types by calling std::memset() at most 2 times.
- Dominant language
- C++
- Stars
- 65
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/circular_buffer
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
boostorg/circular_buffer#53 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
boostorg/circular_buffer#51 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
boostorg/circular_buffer#48 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
boostorg/circular_buffer#47 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
boostorg/circular_buffer#46 · 4 comments ·
All issues in boostorg/circular_buffer
Similar issues
-
ai_reviewed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ydb-platform/ydb#53869 · 3 comments ·
-
bug cert blocker needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
project-chip/connectedhomeip#74373 ·
-
upstream update
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
vllm-project/vllm-ascend#17329 ·