MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Union slowdown when SameTest is specified

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101384] Re: [mg101378] Union slowdown when SameTest is specified
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sat, 4 Jul 2009 06:42:56 -0400 (EDT)
  • References: <200907030940.FAA19348@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

I assume that default tests are hard-coded in a preferential way.

The same might explain why, for a version or two, Tally was broken for  
some tests but unbroken for others (including the default).

Bobby

On Fri, 03 Jul 2009 04:40:19 -0500, J Siehler <jsiehler at gmail.com> wrote:

> 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!
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: Union slowdown when SameTest is specified
  • Next by Date: Re: Re: NDSolve to solve a set of "loop" equations
  • Previous by thread: Union slowdown when SameTest is specified
  • Next by thread: Re: Union slowdown when SameTest is specified