develooper Front page | perl.perl5.porters | Postings from October 2014

significant slowdown in float arithmetic

Thread Next
From:
Dave Mitchell
Date:
October 25, 2014 15:50
Subject:
significant slowdown in float arithmetic
Message ID:
20141025155040.GR5204@iabyn.com
I just noticed that the nbody benchmark is about 25% slower in 5.21.5
compared with 5.21.4 (and older).

It seems that floating-point arithmetic is considerably slower after this
commit (although I haven't looked at why):

    commit 0f83c5a4f945d1919a6ff6564a3a18375f15f949
    Author:     Jarkko Hietaniemi <jhi@iki.fi>
    AuthorDate: Mon Sep 22 21:37:38 2014 -0400
    Commit:     Jarkko Hietaniemi <jhi@iki.fi>
    CommitDate: Tue Sep 23 08:29:53 2014 -0400

    Avoid mixing Inf/NaN with IV/UV.
    
    It really makes no sense to ask what's the IV/UV of this Inf/NaN,
    or turn on the IOK/UV flags (private or public).

For example, 

    my $n = 0.0;
    my $a = 0.1;
    $n += $a*$a + $a*$a + $a*$a for 0..10_000_000;

These two miniperls are ones built non-threaded, -O2 just before and after
that commit:

$ time  ~/tmp/miniperl-413 ~/tmp/p; time  ~/tmp/miniperl-412 ~/tmp/p

real	0m1.874s
user	0m1.870s
sys	0m0.000s

real	0m2.296s
user	0m2.292s
sys	0m0.001s



-- 
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
    -- Dennis, "Monty Python and the Holy Grail"

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About