diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 348959d32167..207d5949448e 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -115,6 +115,9 @@ jobs: --host-dmd "$HOST_DMD" \ --out "$GITHUB_WORKSPACE/results.json" + - name: Show results + run: cat "$GITHUB_WORKSPACE/results.json" + # perf-comment.yml picks this up and posts the comment. - name: Upload results if: github.event_name == 'pull_request' diff --git a/compiler/src/dmd/main.d b/compiler/src/dmd/main.d index 2d7f3739d7c6..a3cccbbad59b 100644 --- a/compiler/src/dmd/main.d +++ b/compiler/src/dmd/main.d @@ -178,6 +178,37 @@ private int tryMain(const(char)[][] argv, out Param params) Strings libmodules; global._init(); + // TESTING ONLY — deliberate busy loop to verify perf bot detects regressions. + // Uses ldc.llvmasm optimization barrier so LLVM cannot constant-fold or delete + // the loop. Same technique as Google Benchmark's DoNotOptimize. + // Remove before merging. + { + version (LDC) + { + import ldc.llvmasm; + long dummy = 1; + foreach (i; 0 .. 500_000) + { + dummy ^= (dummy << 13); + dummy ^= (dummy >>> 7); + dummy ^= (dummy << 17); + __asm!void("", "r,~{memory}", dummy); + } + } + else + { + long dummy = 1; + foreach (i; 0 .. 500_000) + { + dummy ^= (dummy << 13); + dummy ^= (dummy >>> 7); + dummy ^= (dummy << 17); + } + if (dummy == 0) + fputs("", stderr); + } + } + ErrorSink eSink = global.errorSink; scope(exit)