- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
good equality news
Thu, 2009-06-11, 22:29
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!
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