Union slowdown when SameTest is specified
- To: mathgroup at smc.vnet.net
- Subject: [mg101378] Union slowdown when SameTest is specified
- From: J Siehler <jsiehler at gmail.com>
- Date: Fri, 3 Jul 2009 05:40:19 -0400 (EDT)
Hello group! I was a little surprised and puzzled by the following:
In[1]:= $Version
Out[1]= "7.0 for Mac OS X PowerPC (32-bit) (November 10, 2008)"
In[2]:= data = RandomInteger[{1, 10}, {5000, 2, 12}];
Timing[Union[data];]
Out[3]= {0.008138, Null}
So far so good; so far so speedy. But why does this happen:
In[4]:= Timing[Union[data, SameTest -> Equal];]
Out[4]= {15.313, Null}
Or more egregiously,
In[5]:= Timing[Union[data, SameTest -> (First@#1 == First@#2 &)];]
Out[5]= {86.293, Null}
There's nothing special about the form of the data here, just it
happens to be similar in form to the data I was working on when I
experienced terrible slowdown with the SameTest that I've shown in the
third example - which doesn't seem like a demanding comparison. So
can anyone explain the orders-of-magnitude change in times here? Much
appreciated!
- Follow-Ups:
- Re: Re: Re: Union slowdown when
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Re: Union slowdown when SameTest is
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Re: Union slowdown when SameTest is
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Union slowdown when SameTest is specified
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Union slowdown when SameTest is specified
- From: danl@wolfram.com
- Re: Union slowdown when SameTest is specified
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Re: Re: Union slowdown when