Re: Choice of data structure for large event queues?
From: Thad Smith (thadsmith_at_acm.org)
Date: 12/24/04
- Next message: Jack Klein: "Re: Question about creating a serial connection using posix"
- Previous message: Nick Landsberg: "Re: The Nerd Quotient"
- In reply to: Chris McDonald: "Choice of data structure for large event queues?"
- Next in thread: Chris McDonald: "Re: Choice of data structure for large event queues?"
- Reply: Chris McDonald: "Re: Choice of data structure for large event queues?"
- Reply: moi: "Re: Choice of data structure for large event queues?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Dec 2004 22:56:19 -0600
Chris McDonald wrote:
>
> Hello, I have been implementing and measuring calendar-queues to manage
> time-ordered event queues in a simulation.
>
> The basic functions of enqueuing and dequeuing work very well (very fast)
> for simulations involving thousands, even hundreds of thousands,
> of pending events.
>
> However, my simulation also needs to occassionally, maybe 2% of the time,
> remove a "random" event from the queue - keeping the the queue
> balanced/ordered correctly for the more frequent enqueuing and dequeuing.
> Of course, with calendar-queues, this degenerates to linear behaviour -
> which is woeful.
I haven't used calendar queues, but did some reading from the net.
How many buckets do you use for the events and what are the average
number of elements per bucket? The cost of deleting an element should
be basically the cost of finding the element to be deleted. If you
have a pointer to the item to be deleted, then the cost is very
small. If you have to search for it, then, to my understanding,
finding the element is proportional to the number of items in the
bucket, which is the same cost as choosing the minimum if the bucket
is unsorted or doing an insertion if the bucket is sorted. Either
way, the cost should be similar to insertion or minimum item removal.
Thad
- Next message: Jack Klein: "Re: Question about creating a serial connection using posix"
- Previous message: Nick Landsberg: "Re: The Nerd Quotient"
- In reply to: Chris McDonald: "Choice of data structure for large event queues?"
- Next in thread: Chris McDonald: "Re: Choice of data structure for large event queues?"
- Reply: Chris McDonald: "Re: Choice of data structure for large event queues?"
- Reply: moi: "Re: Choice of data structure for large event queues?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|