-
Notifications
You must be signed in to change notification settings - Fork 0
Add double buffering with object pooling for immutable, append-only vector collections #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@copilot Ask question to finish the design. |
Co-authored-by: doganulus <[email protected]>
Co-authored-by: doganulus <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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.