Unverified Commit ccbc9a1a authored by Harry Barber's avatar Harry Barber Committed by GitHub
Browse files

Revert "RFC30: Compile time benchmark" (#2756)

## Motivation and Context

There seems to be some problem which causes this CI job to fail.
https://github.com/awslabs/smithy-rs/actions/runs/5209247728/jobs/9398874499

Reverting smithy-rs#2617 until we have a clearer picture of why and how
to fix.
parent a6c3aba5
Loading
Loading
Loading
Loading
+1 −38
Original line number Diff line number Diff line
@@ -135,45 +135,10 @@ jobs:
      run: |
        aws s3 cp target/doc "s3://${S3_BUCKET_NAME}/docs/${{ inputs.head_revision }}" --recursive

  compiletime-benchmark:
    runs-on: ubuntu-latest
    name: Run Compiletime Benchmark
    permissions:
      id-token: write
      contents: read
      pull-requests: write
    outputs:
      compiletime-benchmark: ${{ steps.compiletime-benchmark.outputs.compiletime-benchmark }}
    steps:
    - uses: actions/checkout@v3
    - uses: actions/cache@v3
      name: Gradle Cache
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
      # JDK is needed to generate code
    - name: Set up JDK
      uses: actions/setup-java@v3
      with:
        distribution: corretto
        java-package: jdk
        java-version: ${{ env.java_version }}
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ env.rust_version }}
    - name: run benchmark
      id: run-compiletime-benchmark
      run: bash tools/ci-scripts/compiletime-benchmark && cat /tmp/compiletime-benchmark.md >> "$GITHUB_OUTPUT"

  post-bot-comment:
    needs:
    - generate-diff
    - generate-doc-preview
    - compiletime-benchmark
    runs-on: ubuntu-latest
    name: Post bot comment
    permissions:
@@ -199,8 +164,6 @@ jobs:
            issue_number: ${{ inputs.issue_number }},
            owner: context.repo.owner,
            repo: context.repo.repo,
            body: '${{ steps.compiletime-benchmark.outputs.compiletime-benchmark }}\n\n' +
              '${{ steps.bot-messages.outputs.codegen-diff }}\n\n' +
            body: '${{ steps.bot-messages.outputs.codegen-diff }}\n\n' +
              '${{ needs.generate-doc-preview.outputs.bot-message }}\n\n'
              
          })
+0 −33
Original line number Diff line number Diff line
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
set -eux

export TIMEFORMAT=%R

function compile() {
    cd $1 &&
        export CARGORUSTFLAG="" &&
        cargo build &>/dev/null && cargo clean && # this is for downloading crates
        \time --format="%e seconds" bash -c "cargo build  &> /dev/null" && cargo clean &&
        \time --format="%e seconds" bash -c "cargo build --release  &> /dev/null" && cargo clean &&
        export CARGORUSTFLAG="--cfg aws_sdk_unstable" &&
        \time --format="%e seconds" bash -c "cargo build --all-features &>/dev/null" && cargo clean &&
        \time --format="%e seconds" bash -c "cargo build --all-features --release &>/dev/null" && cargo clean
}

./gradlew :aws:sdk:assemble
DIR=$PWD
for variable in $(dir "aws/sdk/build/aws-sdk/sdk"); do
    if [[ $variable != *"aws-"* ]]; then
        echo "START" &>>/tmp/compiletime-benchmark.txt
        echo "$variable" &>>/tmp/compiletime-benchmark.txt
        compile "$DIR/aws/sdk/build/aws-sdk/sdk/$variable" &>>/tmp/compiletime-benchmark.txt
        echo "END" &>>/tmp/compiletime-benchmark.txt
    fi
done

cd $DIR
python3 tools/compiletime-benchmark/format.py
+0 −40
Original line number Diff line number Diff line
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

import itertools


def main():
    f = open("/tmp/compiletime-benchmark.txt", "r").read()
    iter = map(lambda x: x.split("END"), f.split("START"))
    iter = itertools.chain.from_iterable(iter)
    markdown = """
    | sdk name | dev | release | dev all features | release all features |
    | -------- | --- | ------- | ---------------- | -------------------- |
    """
    idx = 0
    for i in iter:
        idx += 1
        print("============")
        print(idx)
        print(i)
        print("============")

        lines = i.splitlines()
        if len(lines) > 1:
            continue

        sdk_name = lines[0]
        row = "\n|" + sdk_name + \
            "|".join(map(lambda x: float(x), lines[1:])) + "|"

        markdown += row

    print(markdown)
    with open("/tmp/compiletime-benchmark.md", "w") as f:
        f.write(markdown)
        f.flush()

main()