May as well throw out some data structure prOn for everyone. This paper was published in 2005.
Ladder Queues
Search found 7 matches
- Sun Jan 04, 2009 7:53 pm
- Forum: bsnes Dev Talk
- Topic: Delta queue design
- Replies: 35
- Views: 78196
- Sat Jan 03, 2009 12:33 am
- Forum: bsnes Dev Talk
- Topic: wip05 discussion
- Replies: 18
- Views: 49858
Also, blargg's code had a nice optimization that replaced swaps in the enqueue() and deqeue() methods with a single assignment. This would cut the number of memory accesses in half. I don't see how that's possible, but I only had a cursory glance. I'll go look again. I have some comments in the cod...
- Fri Jan 02, 2009 11:05 pm
- Forum: bsnes Dev Talk
- Topic: wip05 discussion
- Replies: 18
- Views: 49858
Bah, screw that. I'll just use a normalize function instead. Call it once a second or so. void normalize() { for(unsigned i = 0; i < heapsize; i++) heap[i].counter -= counter; counter = 0; } Wait, do not be so unidealistic! That normalizing is just plainly ugly. Why not inline the function blargg p...
- Fri Jan 02, 2009 4:51 am
- Forum: bsnes Dev Talk
- Topic: Delta queue design
- Replies: 35
- Views: 78196
Here's a version using an array-based heap, absolute times, and no need to periodically adjust them, as overflow doesn't cause any problems. Full code + exerciser: Delta_Queue_2.cpp I threw together a C implementation of the linked-list and heap-based versions. The heap does not coalesce events by ...
- Fri Jan 02, 2009 2:56 am
- Forum: bsnes Dev Talk
- Topic: Delta queue design
- Replies: 35
- Views: 78196
sinamas, if you keep track of the absolute time of the last event, inserting an event past all the others can done in constant time. True, but we still get linear complexity on average if the common case position is before the end and has a mean proportional to N. I have to agree with sinamas here....
- Thu Jan 01, 2009 6:38 pm
- Forum: bsnes Dev Talk
- Topic: Delta queue design
- Replies: 35
- Views: 78196
- Wed Dec 31, 2008 1:02 am
- Forum: bsnes Dev Talk
- Topic: Delta queue design
- Replies: 35
- Views: 78196
Re: Delta queue design
Background info: There's probably no more than ~10 events: DRAM refresh, DMA trigger, HDMA trigger, HDMA init trigger, NMI trigger, IRQ trigger, ALU step, Joypad poll step, etc. They don't stack, so we can make our queue a fixed size, no need for a resizable vector. The only way I can think to impl...