<commit_before>#!/bin/bash

set -euxo pipefail

rm -rf /tmp/rustc-pgo

python2.7 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
    --stage 2 library/std --rust-profile-generate=/tmp/rustc-pgo

RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
    --crate-type=lib ../library/core/src/lib.rs

# Download and build a single-file stress test benchmark on perf.rust-lang.org.
function pgo_perf_benchmark {
    local PERF=e095f5021bf01cf3800f50b3a9f14a9683eb3e4e
    local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF
    local name=$1
    curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs

    RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
        --crate-type=lib /tmp/$name.rs
}

pgo_perf_benchmark externs
pgo_perf_benchmark ctfe-stress-4<commit_msg>update rustc-perf version that is used for PGO<commit_after>#!/bin/bash

set -euxo pipefail

rm -rf /tmp/rustc-pgo

python2.7 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
    --stage 2 library/std --rust-profile-generate=/tmp/rustc-pgo

RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
    --crate-type=lib ../library/core/src/lib.rs

# Download and build a single-file stress test benchmark on perf.rust-lang.org.
function pgo_perf_benchmark {
    local PERF=9442def56a39d742bf27ebcc3e0614cf117e1bc2
    local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF
    local name=$1
    curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs

    RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
        --crate-type=lib /tmp/$name.rs
}

pgo_perf_benchmark externs
pgo_perf_benchmark ctfe-stress-4
{'fraction_non_alphanumeric': 0.13612866168868468, 'fraction_numerical': 0.04709936817920735, 'mean_word_length': 3.548302872062663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7097871', 'n_tokens_mistral': 734, 'n_tokens_neox': 682, 'n_words': 110}