Improve performance of CallArity

Authored by nomeata on May 21 2018, 10:29 AM.



the hot path contained a call to

v `elemUnVarSet` (neighbors g v)

and creating the set of neighbors just to check if v is inside
accounted for half the allocations of the test case of Trac #15164.

By introducing a non-allocating function hasLoopAt for this we shave
off half the allocations. This brings the total cost of Call Arity down
to 20% of time and 23% of allocations, according to a profiled run. Not
amazing, but still much better.

Test Plan

Run harbormaster to get updated performance numbers for tests,
update them, and push.

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nomeata created this revision.May 21 2018, 10:29 AM

Looks reasonable to me. I'll let you land when you are ready.

I was only uploading this for the harbormaster run, but thanks for the review anyways :-)

Hmm, Harbormaster seems to be slow right now… build has been running for 9h…

Indeed it's been pretty terrible recently. It has also been affecting my ability to stabilize the tree again. I may need to provision another builder if it's not reasonably caught up by tomorrow.

This revision was not accepted when it landed; it landed in state Needs Review.May 22 2018, 11:54 AM
This revision was automatically updated to reflect the committed changes.