Re: [Q] Unrelated to scotty, but . . .(Router Discovery cont.)

Peter da Silva (peter@baileynm.com)
Tue, 24 Jun 1997 08:57:01 -0500 (CDT)

> - Fast lookup of whether an element exists (searching through a list for it
> is not acceptable)
> - The ability to hold from 10,000 to 100,000 or more elements, and their values
> - The ability to add elements at a reasonable rate (searching through a list
> of 50,000 elements, looking for the correct place to put this one is
> unacceptable)

% tcl
tcl>for {set i 0} {$i < 10000} {incr i} {
=>set a($i) $i
=>}
tcl>time {expr $a(4000)} 4000
48 microseconds per iteration
tcl>time {rand 10000} 4000
2311 microseconds per iteration
tcl>time {expr $a([rand 10000])} 4000
2453 microseconds per iteration
tcl>

Rand is pretty slow, I'm surprised.

I think these times indicate it's doable with arrays. For random access to
the array you're looking at 140 microseconds per access, on a 230 MHz Alpha.

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.