Add double buffering with object pooling for immutable, append-only vector collections#8
Add double buffering with object pooling for immutable, append-only vector collections#8Copilot wants to merge 6 commits into
Conversation
|
@copilot Ask question to finish the design. |
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
I have a question about the design to ensure it meets your requirements: Thread Safety: The current implementation is single-threaded. Should If yes, this would require:
Or is the current single-threaded design sufficient for your use case? |
|
@copilot Introduce a DataPointSequence and update these sequences at every step. |
|
@copilot Single threaded implementation is sufficient. |
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Implemented The new type provides:
Each call to All 65 tests passing, including 11 new tests specifically for DataPointSequence. |
|
@copilot Implement a flat object pool and keep vector reference as begin and end pointers. |
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Implemented The new implementation uses:
Key methods:
All 80 tests passing, including 14 new tests for FlatObjectPool. |
|
@copilot Object created will be immutable and never erased from the back buffer in one step. Adjust the design according to this information. |
Co-authored-by: doganulus <1174212+doganulus@users.noreply.github.com>
Redesigned DataPointSequence in commit e1e4d03 to support immutable, append-only semantics. Key Changes:
Example:
Objects remain immutable in contiguous flat buffer for optimal cache locality. All 80 tests passing with updated behavior. |
Implements double buffering for lock-free sequential updates of object vector collections with memory pooling to reduce allocation overhead. Features immutable, append-only semantics for DataPointSequence ideal for time-series data.
Implementation
ObjectPool
Vec<T>instancesFlatObjectPool
set()methodacquire(size),release(begin, end),get_slice(),set()DoubleBuffer
swap()atomically exchanges buffers and recycles old front buffer via poolDataPointSequence
update()calladd_point(),add_points(),update(),current(),step(),pending_count()Usage
DataPointSequence (High-Level API - Append-Only)
FlatObjectPool (Advanced Memory Management)
DoubleBuffer (Low-Level API)
Testing
Key Features
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.