Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreysolovyev381/circular_buffer_fixed_size
Short exercise on a fixed size circular buffer data structure.
https://github.com/andreysolovyev381/circular_buffer_fixed_size
circular-buffer circular-queue cpp cpp20 data-structures
Last synced: about 2 months ago
JSON representation
Short exercise on a fixed size circular buffer data structure.
- Host: GitHub
- URL: https://github.com/andreysolovyev381/circular_buffer_fixed_size
- Owner: andreysolovyev381
- License: mit
- Created: 2023-12-02T20:16:51.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-31T10:05:57.000Z (9 months ago)
- Last Synced: 2024-04-01T00:19:32.003Z (9 months ago)
- Topics: circular-buffer, circular-queue, cpp, cpp20, data-structures
- Language: C++
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
### Reasoning behind
- I have a specific usage of data window, specifically, my data comes in one at a time, so I am mostly interested in comparing joint usage of the following functionality:
```cpp
push_back();
pop_front();
```
Naturally, there are some solutions for that, but the idea is to use `std::array` as it is expected to win over known implementations.### WIP problem
Something strange happens here - circular buffer on `std::array` w/o any reallocation and w/o calling an elem dtor upon destruction loses to both `std::deque` and `boost::circular_buffer`. Trying to figure out what are the reasons.
```bash
-----------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------
PushBackPopFrontDeque/64 140 ns 139 ns 5045115
PushBackPopFrontDeque/512 1072 ns 1070 ns 660096
PushBackPopFrontDeque/2048 4227 ns 4219 ns 165916
PushBackPopFrontBoostCB/64 88.5 ns 88.4 ns 7919658
PushBackPopFrontBoostCB/512 691 ns 690 ns 1014275
PushBackPopFrontBoostCB/2048 2759 ns 2754 ns 254187
PushBackPopFrontCBFixed/64 175 ns 174 ns 4013473
PushBackPopFrontCBFixed/512 856 ns 855 ns 818852
PushBackPopFrontCBFixed/2048 3406 ns 3400 ns 205866```