[Chapel Merge] Add option to build compiler with jemalloc

Branch: refs/heads/main
Revision: 133ec72
Author: aconsroe-hpe
Link: Add option to build compiler with jemalloc by aconsroe-hpe · Pull Request #18627 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #18627 from aconsroe-hpe/jemalloc-host-build-pretty

Add option to build compiler with jemalloc

reviewed and much help from @ronawho (thank you!)

We are seeing a compile time reduction of around 18% for both hello world and larger compiles when using jemalloc instead of the system allocator.

  • Adds CHPL_HOST_{MEM,JEMALLOC}
  • Adds CHPL_TARGET_{MEM,JEMALLOC} which take their default from CHPL_{MEM,JEMALLOC} if not explicitly set. The former takes precedence over the latter

Platform differences as follows - more details in commit message:

  • Linux: CHPL_HOST_MEM=jemalloc only supported when CHPL_HOST_JEMALLOC=bundled
  • Darwin: CHPL_HOST_MEM=jemalloc only supported when CHPL_HOST_JEMALLOC=system
  • Cygwin: jemalloc not supported (this was previously true)

Some example timings show a 10-25% reduction in compilation time.

wall time in seconds. best of 2

chpl examples/hello.chpl

   > cstdlib | jemalloc |

--------|--------:|---------:expressionless:
clang | 4.08 | 3.56 |
llvm | 3.96 | 3.41 |

chpl test/regex/correctness.chpl

   > cstdlib | jemalloc |

--------|--------:|---------:expressionless:
clang | 7.76 | 6.67 |
llvm | 7.40 | 6.26 |

chpl --fast test/regex/correctness.chpl

   > cstdlib |jemalloc |

--------|--------:|--------:expressionless:
clang | 17.51 | 16.60 |
llvm | 15.13 | 13.41 |

Arkouda on a Cray CS

   > cstdlib | jemalloc |

--------|--------:|---------:expressionless:
gcc | 563.64 | 503.90 |
llvm | 624.70 | 525.94 |

Tested on Linux and Mac

Modified Files:
A third-party/jemalloc/Makefile.host.include-bundled

A third-party/jemalloc/Makefile.host.include-none
A third-party/jemalloc/Makefile.host.include-system
A third-party/jemalloc/Makefile.target.include
A util/cron/test-host-jemalloc.bash
R third-party/jemalloc/Makefile.include
M Makefile
M compiler/Makefile
M doc/rst/usingchapel/chplenv.rst
M make/Makefile.base
M modules/standard/ChapelEnv.chpl
M runtime/Makefile
M runtime/etc/Makefile.mem-jemalloc
M runtime/make/Makefile.runtime.mem-jemalloc
M third-party/Makefile
M third-party/jemalloc/Makefile
M util/chplenv/chpl_jemalloc.py
M util/chplenv/chpl_mem.py
M util/chplenv/overrides.py
M util/chplenv/printchplenv.py
M util/chplenv/third_party_utils.py

Compare: https://github.com/chapel-lang/chapel/compare/1b0aec887556...133ec720993c