1. Testing Sequences for Uniqueness

What is the fastest way to check two sequences (of six numbers) for
uniqueness?

If I have the following:

x = { 1 , 2 , 3 , 4 , 5 , 6 }
y = { 1 , 2 , 3 , 4 , 5 , 7 }

What's the fastest are_different( x , y ) function out there?

Thanks in advance!
ck





__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

new topic     » topic index » view message » categorize

2. Re: Testing Sequences for Uniqueness

What's wrong with "compare()" ? With the program below, I'm getting about
32,500 compares per second.
---------------------
atom e
integer x,i,t
i=0
t=5
e = time()+t
while time()<e do
x=compare ({1,2,3,4,5,6},{1,2,3,4,5,6})
i+=1
end while
printf(1, "%f", i/t)
-------------------------



----- Original Message -----
From: "ck lester" <cklester at YAHOO.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, August 25, 2000 5:38 AM
Subject: Testing Sequences for Uniqueness


> What is the fastest way to check two sequences (of six numbers) for
> uniqueness?
>
> If I have the following:
>
> x = { 1 , 2 , 3 , 4 , 5 , 6 }
> y = { 1 , 2 , 3 , 4 , 5 , 7 }
>
> What's the fastest are_different( x , y ) function out there?
>
> Thanks in advance!
> ck
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Testing Sequences for Uniqueness

COL (chuckling out loud). I guess you get to a point where you're doin' some
complicated stuff and you simply FORGET the simple stuff.

sheesh.

Thanks, Derek, for the heads up! smile

-ck

----- Original Message -----
From: Derek Parnell <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, August 24, 2000 3:48 PM
Subject: Re: Testing Sequences for Uniqueness


> What's wrong with "compare()" ? With the program below, I'm getting about
> 32,500 compares per second.
> ---------------------
> atom e
> integer x,i,t
> i=0
> t=5
> e = time()+t
> while time()<e do
> x=compare ({1,2,3,4,5,6},{1,2,3,4,5,6})
> i+=1
> end while
> printf(1, "%f", i/t)
> -------------------------
>
>
>
> ----- Original Message -----
> From: "ck lester" <cklester at YAHOO.COM>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Friday, August 25, 2000 5:38 AM
> Subject: Testing Sequences for Uniqueness
>
>
> > What is the fastest way to check two sequences (of six numbers) for
> > uniqueness?
> >
> > If I have the following:
> >
> > x = { 1 , 2 , 3 , 4 , 5 , 6 }
> > y = { 1 , 2 , 3 , 4 , 5 , 7 }
> >
> > What's the fastest are_different( x , y ) function out there?
> >
> > Thanks in advance!
> > ck
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Talk to your friends online with Yahoo! Messenger.
> > http://im.yahoo.com


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: Testing Sequences for Uniqueness

methinks, mayhaps, thine benchmark hath flaw :(((((

you are entering the realm of cached data since you
are not comparing different sequences each run...

> x=compare ({1,2,3,4,5,6},{1,2,3,4,5,6})
is the problem child line....

so my suggestion is to create a large sequence of
pairs of 6 element sequences and u can step thru
them while timing the equality of those pairs

-----------tested code
sequence data,result
atom now
object temp
constant tries = 250000
constant dataset = {6,6,6,6,6,6}

--gotta store the result or EU will possibly
--throw away the equality test in an effort
--to optimize dead code
puts(1,"Creating empty dataset\n")
data   = repeat({},tries)
result = repeat({},tries)

puts(1,"Filling dataset with randomness\n")
for i = 1 to tries do
   data[i] = {rand(dataset),rand(dataset)}
end for

puts(1,"Beginning benchmark\n")
--we use the temp variable as it is
--less burden on the benchmark
--as we dont slice as much this way
now = time()
for i = 1 to tries do
   temp   = data[i]
   result[i] = equal(temp[1],temp[2])
end for
now = time() - now
printf(1,"%d tries in %f seconds",{tries,now})

------------end code

on a pIII733 with 128mb 133mhz ram
250000 tries in 0.270000 seconds

on a p200mmx with 48mb EDO ram
75000 tries in 0.220000 seconds

but it took several seconds to create the dataset
for each run on both machines....

i'm thinking equal() & compare() are fast nuff ;)
and who said EU was slow?
--Hawke'


_____NetZero Free Internet Access and Email______
   http://www.netzero.net/download/index.html

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu