This page is no longer maintained — Please continue to the home page at www.scala-lang.org

good equality news

1 reply
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

I ran some measurements with my new does-what-you-probably-want equality
code in place. The first test has a big list of Integers and a big list
of Longs and compares every element to every other one. (I'm only
showing one run but the numbers are extremely consistent.)

Before paulp:

real 0m7.454s
user 0m7.348s
sys 0m0.074s

After paulp:

real 0m6.942s
user 0m6.816s
sys 0m0.071s

So statically typed comparisons are a little faster. The other test
creates a big List[AnyRef] which is actually composed of Strings,
RichStrings, BigInts, jl.Integers, jl.Longs, etc. and again compares
every element to every other.

Before paulp: Matches = 28500

real 0m11.651s
user 0m11.414s
sys 0m0.101s

After paulp: Matches = 30352

real 0m9.743s
user 0m9.564s
sys 0m0.089s

(Notice the increase in match count, because "bob" == "bob".reverse and
so on.) Although we have to do additional dynamic analysis, comparisons
are at least 15% faster than before. This is because I brought the hand
optimizer to the BoxesRunTime logic. It can probably be improved a ways
yet, but this is by no means my specialty and my goal was really only to
check it in faster than I checked it out. But how about if I bank that
speed gain so I can spend it on whatever crazy equality idea I have six
months from now. Ha!

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: good equality news

On Thu, Jun 11, 2009 at 11:29 PM, Paul Phillips wrote:
> I ran some measurements with my new does-what-you-probably-want equality
> code in place.  The first test has a big list of Integers and a big list
> of Longs and compares every element to every other one.  (I'm only
> showing one run but the numbers are extremely consistent.)
>
> Before paulp:
>
> real    0m7.454s
> user    0m7.348s
> sys     0m0.074s
>
> After paulp:
>
> real    0m6.942s
> user    0m6.816s
> sys     0m0.071s
>
> So statically typed comparisons are a little faster.  The other test
> creates a big List[AnyRef] which is actually composed of Strings,
> RichStrings, BigInts, jl.Integers, jl.Longs, etc. and again compares
> every element to every other.
>
> Before paulp: Matches = 28500
>
> real    0m11.651s
> user    0m11.414s
> sys     0m0.101s
>
> After paulp: Matches = 30352
>
> real    0m9.743s
> user    0m9.564s
> sys     0m0.089s
>
> (Notice the increase in match count, because "bob" == "bob".reverse and
> so on.) Although we have to do additional dynamic analysis, comparisons
> are at least 15% faster than before.  This is because I brought the hand
> optimizer to the BoxesRunTime logic.  It can probably be improved a ways
> yet, but this is by no means my specialty and my goal was really only to
> check it in faster than I checked it out.  But how about if I bank that
> speed gain so I can spend it on whatever crazy equality idea I have six
> months from now.  Ha!
>
Yes, good idea. That's great that you could achieve these speedups!

Cheers

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland