libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_array_deque.h>
Data Fields | ||
struct { | ||
GblRingBuffer ringBuffer | ||
} | private_ | |
Circular array-based double-ended queue container.
GblArrayDeque is a very flexible container type which combines the fast random access and cache coherency of a contiguous array with the semantics of a double-ended queue. This means that not only are random accesses extremely efficient, but also adding and removing entries from either end as well.
This container is well-suited for data sets which can grow or shrink from either end, but which are typically accessed as an array.
Operation | Time Complexity |
---|---|
iteration | O(N) |
insertion (back or front) | O(1) |
insertion (middle) | O(N) |
removal (back or front) | O(1) |
removal (middle) (WIP) | O(N) |
access (front or back) | O(1) |
random access (middle) | O(1) |
For reference, the following are the results of the profiler unit tests for some common operations shared between GblArrayList (comparable to std::vector) and GblArrayDeque (1024 pointer-sized entries):
Test | GblArrayList | GblArrayDeque |
---|---|---|
at | 0.004 ms | 0.008 ms |
pushBack | 0.030 ms | 0.030 ms |
pushFront | 0.116 ms | 0.027 ms |
Definition at line 93 of file gimbal_array_deque.h.
GblRingBuffer GblArrayDeque::ringBuffer |
Definition at line 95 of file gimbal_array_deque.h.