Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Block! v List! dilema...

From: holger:rebol at: 6-Apr-2001 11:52

On Fri, Apr 06, 2001 at 07:09:05PM +0000, Chris wrote:
> Using a block, I guess that pick for a block is an O(1) operation - a > simple array lookup?
Yes.
> Now the problem - when a user comments on a bug, or a > project admin updates the status of a bug, I want that bug to be moved to > the start of the buglist block. Remembering that this list could end up > being long (probably into the thousands), removing an element in the middle > and inserting it at the start would, I guess, be rather costly.
Yes, but it should not be a problem unless you move a large number of elements around in a loop. A single remove/insert only takes a small fraction of a second, even in very large blocks.
> The > alternative is to use a list of course: that makes the move very quick, > but what does it do to my display code? Is pick for list still O(1) - I > guess it isn't?
No, it is O(n).
> Given that displays vastly outnumber moves, should I just stick with blocks? > Or does anyone have a better suggestion?
Blocks are probably better. -- Holger Kruse [holger--rebol--com]