-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added slotting for sibling events in queue
The queue data-structure has been molded into a 2d double linked-list with slots for each set of events that expire at a given time. Other than having little downsides, the biggest benifit is a constant-time enqueueing of events with no delay while still maintaining ordering. To reduce the memory overhead for each event, the queue is not doubly-linked in both directions. Instead, noting that no more than 1 reference is needed for each event, the queue is stored as a 2d single linked-list with generalized pointers to whatever references events. To maintain constant-enqueueing without a tail pointer for each slot, events are inserted as a stack and reversed on dequeueing. This does not impact amortized complexity as each event already has to be marked dirty. Notable performance impact (make prof): equeue_post_many_prof: 202 cycles (+98%) equeue_post_future_many_prof: 207 cycles (+98%) equeue_alloc_size_prof: 56 bytes (-16%) equeue_alloc_many_size_prof: 64000 bytes (-14%) equeue_alloc_fragmented_size_prof: 64000 bytes (-14%)
- Loading branch information
Showing
2 changed files
with
78 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters