[Chapel Merge] New version of nbody

Branch: refs/heads/main
Revision: 86ac3df
Author: bradcray
Link: Unavailable
Log Message:

Merge pull request #19537 from bradcray/new-param-nbody

New version of nbody

[reviewed by @ronawho and @chapel-lang/perf-team ]

This is a new version of the nbody shootout I made for fun last night
that:

  • changes consts to params
  • changes an array to a tuple
  • changes loops to param loops
  • gets rid of the refs (used to be crucial for perf, here don't seem to be)

In the commit history of this PR, you'll also find:

  • implements a little numerical change to the sqrt of the sum of squares
    (which may be in the noise)
    though I ended up backing this out because the impact was modest and
    it felt slightly too heroic for my tastes / I was trying to minimize diffs with
    the previously submitted version.

On my personal Mac laptop where I was developing this, I saw these
changes improve the performance from 2.53s to 1.56s. On my (older)
work Mac, the changes were more modest as a percentage: from
4.28s down to 3.18s.

Elliot took the following more precise timings:

chpl test/studies/shootout/nbody/bradc/nbody-blc.chpl --fast
time -p ./nbody-blc --n=50000000 >/dev/null
Config Time
before 4.95s
now 3.91s

And checking which components make the biggest difference:

Config Time
before 4.95s
param pi 4.95s
tuple bodies 4.22s
param numBodies 4.06s
param loops 3.91s
sumOfSq trick 3.70s
now 3.91s
Modified Files:
M test/studies/shootout/nbody/bradc/nbody-blc.chpl

Compare: https://github.com/chapel-lang/chapel/compare/66fbf57cd412...86ac3dfb634c