When compiling a program with -profile=gc it becomes much slower. GC.stats is called for every allocation, but it collects more information, than is needed for -profile=gc. Replacing the call to GC.stats with a new function, which only returns the needed information, makes the program fast again. I will create a pull request later.
@tim-dlang created dlang/druntime pull request #3164 "Fix issue 21070: -profile=gc makes the program much slower" fixing this issue: - Fix issue 21070: -profile=gc makes the program much slower Replacing the call to GC.stats with a new function, which only returns the needed information, makes the program fast again. https://github.com/dlang/druntime/pull/3164
dlang/druntime pull request #3164 "Fix issue 21070: -profile=gc makes the program much slower" was merged into master: - ba39c957f37861c1ea2e4fdf7bc40408a4ce1998 by Tim Schendekehl: Fix issue 21070: -profile=gc makes the program much slower Replacing the call to GC.stats with a new function, which only returns the needed information, makes the program fast again. https://github.com/dlang/druntime/pull/3164