[chapel-lang/chapel] Refactor the param loop in writef

Branch: refs/heads/master
Revision: 37c6217
Author: e-kayrakli
Log Message:

Merge pull request #16303 from e-kayrakli/refactor-writef

Refactor the param loop in writef

Move the code inside the arg-processing param loop in writef in a separate
helper.

Prior to this PR, we had a very large param loop inside writef. The main problem
with that is that writef is a vararg function, and for each call to writef with
different permutation of types, we create a separate instantiation and for all
of them we unroll a large param loop. This increases the generated code size
significantly if the application is using string/bytes formatting heavily.
Arkouda is one example application.

This PR changes the generated code size in Arkouda as follows (default Arkouda
compilation, gasnet-udp)

version lines of C code
master 4718231
PR 3550247

On XC, with default settings, this shaves off more than 4 minutes in Arkouda
compilation:

version time (s) time (m)
master 1084.931 18.08
PR (initial) 824.845 13.75
PR (after @mppf’s suggestion) 763.251 12.72

https://github.com/Cray/chapel-private/issues/1260#issuecomment-678829764 is
where we realized this issue.

[Reviewed by @mppf and @ronawho]

Test:

  • [x] standard
  • [x] gasnet

Modified Files:
M modules/standard/IO.chpl

Compare: https://github.com/chapel-lang/chapel/compare/af05290c4735...37c6217e5f3a