Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC30: Compile time benchmark #2617

Merged

Conversation

thomas-k-cameron
Copy link
Contributor

@thomas-k-cameron thomas-k-cameron commented Apr 21, 2023

Motivation and Context

This PR implements ci-script for bench marking compile time.
Results are turned into a markdown file and compile time is normalized to a value relative to the compile time of S3's sdk on dev profile without any features.

Benchmark is triggered for every PR.

I considered using AWS batch, however, I decided not to move forward with for following reasons

  • I do not have access to your AWS account, thus making the debugging extremely difficult
  • Fork's github action will always fail if you block access

Testing

NA

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@thomas-k-cameron
Copy link
Contributor Author

At this point, the script does not upload the result markdown file.
Where should it be uploaded? (I think some where on github would be nice.)
I appreciate help.

@thomas-k-cameron thomas-k-cameron force-pushed the RFC30/compiletime-benchmark-to-ci branch 4 times, most recently from 6b7791a to 4d5f117 Compare April 21, 2023 12:24
@thomas-k-cameron thomas-k-cameron force-pushed the RFC30/compiletime-benchmark-to-ci branch from 4d5f117 to 72cbd5d Compare April 21, 2023 12:24
@thomas-k-cameron thomas-k-cameron mentioned this pull request Apr 21, 2023
2 tasks
@thomas-k-cameron
Copy link
Contributor Author

The error is the regex unicode thing. Once the other branch is merged this should be fixed as well.

@thomas-k-cameron thomas-k-cameron marked this pull request as ready for review April 21, 2023 23:18
@thomas-k-cameron thomas-k-cameron requested review from a team as code owners April 21, 2023 23:18
@thomas-k-cameron
Copy link
Contributor Author

Gotta fix this.

Creating network "smithy-rs-buildoqvajw_default" with the default driver
Creating smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Creating smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
bash: ./ci-scripts/compiletime-benchmark: Permission denied
Stopping smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Stopping smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
Removing smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Removing smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
Removing network smithy-rs-buildoqvajw_default

@thomas-k-cameron
Copy link
Contributor Author

I added a script for bench marking the compile time, but it gives me Permission denied.

I have no idea how to fix it. I appreciate help!

bash: ./ci-scripts/compiletime-benchmark: Permission denied

@jdisanti
Copy link
Collaborator

It's probably just missing the execute permission. If you're on a Unix-like system, you just need to chmod +x compiletime-benchmark and commit it.

@thomas-k-cameron
Copy link
Contributor Author

thomas-k-cameron commented May 31, 2023

It's happening on the Github CI.
chmod on my local machine doesn't affect the CI right?
(Sorry I could be wrong.)

Here is a full message.

Run ./smithy-rs/tools/ci-build/ci-action compiletime-benchmark 
  ./smithy-rs/tools/ci-build/ci-action compiletime-benchmark 
  tar cfz artifacts-compiletime-benchmark.tar.gz -C artifacts .
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    rust_version: 1.67.1
    rust_toolchain_components: clippy,rustfmt
    ENCRYPTED_DOCKER_PASSWORD: 
    DOCKER_LOGIN_TOKEN_PASSPHRASE: 
    CACHE_ON_FAILURE: false
    CARGO_INCREMENTAL: 0
Creating network "smithy-rs-buildoqvajw_default" with the default driver
Creating smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Creating smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
bash: ./ci-scripts/compiletime-benchmark: Permission denied
Stopping smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Stopping smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
Removing smithy-rs-buildoqvajw_smithy-rs-build_1 ... 
Removing smithy-rs-buildoqvajw_smithy-rs-build_1 ... done
Removing network smithy-rs-buildoqvajw_default
Error: Process completed with exit code 126.

@thomas-k-cameron
Copy link
Contributor Author

thomas-k-cameron commented Jun 5, 2023

chmod worked. I didn't know the permissions my local machine is transferred on git. TIL

@thomas-k-cameron thomas-k-cameron force-pushed the RFC30/compiletime-benchmark-to-ci branch from 5de9d85 to 7dd284e Compare June 6, 2023 03:10
@thomas-k-cameron
Copy link
Contributor Author

@jdisanti
Where should I upload the benchmark result?

Copy link
Collaborator

@jdisanti jdisanti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I haven't had a chance to look at this closely. This looks really cool.

@@ -297,6 +299,19 @@ jobs:
shell: bash
run: cross test --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.test_aws_exclude }} --workspace

# compile time benchmark
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should get added to the PR bot instead of to CI. That way, the results get posted as a comment on PRs (although this only works for maintainers right now, unfortunately).

The PR bot workflow basically works like this:

  • Kicks off the generate-diff and generate-doc-preview jobs in parallel. You could just add a new compiletime-benchmark job in here.
  • The post-bot-comment job depends on all the parallel jobs, grabs their output, and aggregates it into a human readable comment. Then it posts to the GitHub API to make the comment.

The GitHub Actions job outputs feature is being used to communicate between the jobs. For example:

    outputs:
      bot-message: ${{ steps.generate-preview.outputs.bot-message }}

and

${{ needs.generate-doc-preview.outputs.bot-message }}

Testing this is going to be difficult of course. I think what we could do is after reviewing it to see if it looks like it should work, we could copy it to a new PR so that it has the right permissions for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

Copy link
Contributor Author

@thomas-k-cameron thomas-k-cameron Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially thought about using AWS batch, since you can have better control over the hardware, I can just show the amount of time that it took to finish instead of showing relative values. Also, results are going to be more re-producible.

Since I don't have access to your AWS account, I concluded that it would be very difficult for me to do any debugging.

Just FYI.

@thomas-k-cameron
Copy link
Contributor Author

@jdisanti CI is updated. Would you mind checking it out?

@Velfi
Copy link
Contributor

Velfi commented Jun 7, 2023

@thomas-k-cameron John is out until next week, but this looks good to me. Thanks for all your work.

@Velfi Velfi enabled auto-merge June 7, 2023 14:52
@Velfi Velfi added this pull request to the merge queue Jun 7, 2023
Merged via the queue into smithy-lang:main with commit a6c3aba Jun 7, 2023
@thomas-k-cameron thomas-k-cameron deleted the RFC30/compiletime-benchmark-to-ci branch June 7, 2023 15:49
hlbarber added a commit that referenced this pull request Jun 8, 2023
@Velfi
Copy link
Contributor

Velfi commented Jun 12, 2023

@thomas-k-cameron It turns out this broke CI so we had to revert it. You'll need to open a new PR.

@thomas-k-cameron thomas-k-cameron restored the RFC30/compiletime-benchmark-to-ci branch June 14, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants