boostorg / boostorg/circular_buffer
resize is slow
- Lingua principale
- C++
- Stelle
- 65
- Fork
- 64
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello,
Would it be possible to improve complexity of `circular_buffer::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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- performance
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 52/100