Skip to content

Rfc30/compiletime benchmark to ci #2775

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

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
58512c2
- add python packages for compiletime benchmark
thomas-k-cameron Apr 21, 2023
1d9cd83
remove polars
thomas-k-cameron Apr 21, 2023
72cbd5d
update action
thomas-k-cameron Apr 21, 2023
ea0f876
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 21, 2023
c97dfee
Update ci.yml
thomas-k-cameron Apr 21, 2023
8b73e0d
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 24, 2023
96ec415
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 25, 2023
6f115cd
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 26, 2023
2ad5523
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 27, 2023
3aeba40
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Apr 29, 2023
be405e4
updater
thomas-k-cameron May 5, 2023
6298c76
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron May 5, 2023
6d1f1de
Update ci.yml
thomas-k-cameron May 5, 2023
9006b71
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 5, 2023
34eaadb
update
thomas-k-cameron Jun 5, 2023
09672b0
update
thomas-k-cameron Jun 5, 2023
7dd284e
update
thomas-k-cameron Jun 6, 2023
6844d56
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 6, 2023
232e331
update
thomas-k-cameron Jun 6, 2023
7484dee
FIX
thomas-k-cameron Jun 6, 2023
413a0d2
update
thomas-k-cameron Jun 6, 2023
259177c
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 6, 2023
fd4fc8f
FIX
thomas-k-cameron Jun 6, 2023
d4d37c7
update
thomas-k-cameron Jun 7, 2023
d7ce4d1
update
thomas-k-cameron Jun 7, 2023
aa0c71c
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 7, 2023
b8faed5
Update pull-request-bot.yml
thomas-k-cameron Jun 7, 2023
285f8a1
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
Jun 7, 2023
f8862e1
fix
thomas-k-cameron Jun 14, 2023
efd96f0
fix
thomas-k-cameron Jun 14, 2023
377aa44
update
thomas-k-cameron Jun 14, 2023
31eb747
asdf
thomas-k-cameron Jun 14, 2023
d4add32
fix
thomas-k-cameron Jun 14, 2023
891957d
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 14, 2023
1ead68d
update
thomas-k-cameron Jun 14, 2023
9a528ab
Merge branch 'RFC30/compiletime-benchmark-to-ci' of https://github.co…
thomas-k-cameron Jun 14, 2023
3ebefe4
fix
thomas-k-cameron Jun 15, 2023
967e321
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 15, 2023
44ecdc5
update
thomas-k-cameron Jun 16, 2023
5641d4e
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 16, 2023
3d22fd2
fix
thomas-k-cameron Jun 16, 2023
12b3e56
test
thomas-k-cameron Jun 16, 2023
8e294f9
asdf
thomas-k-cameron Jun 16, 2023
0204c94
fix
thomas-k-cameron Jun 16, 2023
a0c0cf2
fix
thomas-k-cameron Jun 16, 2023
cd25822
update
thomas-k-cameron Jun 16, 2023
34356ec
asdf
thomas-k-cameron Jun 16, 2023
f4a230c
fix
thomas-k-cameron Jun 17, 2023
1ea1fc3
asdf
thomas-k-cameron Jun 17, 2023
3e6fd7e
dsfg
thomas-k-cameron Jun 17, 2023
094cea7
asdf
thomas-k-cameron Jun 17, 2023
18d74e1
fix
thomas-k-cameron Jun 17, 2023
a89a23f
asdf
thomas-k-cameron Jun 17, 2023
8cd5e20
fix
thomas-k-cameron Jun 17, 2023
e1ff66a
fix
thomas-k-cameron Jun 18, 2023
548b139
asdf
thomas-k-cameron Jun 18, 2023
14bff0e
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jun 18, 2023
66c4fbc
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jul 16, 2023
031d40c
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Dec 7, 2023
f15be96
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Dec 20, 2023
d97e899
Update pull-request-bot.yml
thomas-k-cameron Dec 20, 2023
131b097
update
thomas-k-cameron Dec 20, 2023
c14f062
update
thomas-k-cameron Dec 20, 2023
e007493
update
thomas-k-cameron Dec 20, 2023
5bb6b3c
Update pull-request-bot.yml
thomas-k-cameron Dec 20, 2023
2a2166e
update
thomas-k-cameron Dec 20, 2023
93236df
Merge branch 'RFC30/compiletime-benchmark-to-ci' of https://github.co…
thomas-k-cameron Dec 20, 2023
e747e05
update
thomas-k-cameron Dec 20, 2023
3a8fcdf
fix
thomas-k-cameron Dec 20, 2023
51314e2
update
thomas-k-cameron Dec 20, 2023
362ab82
update
thomas-k-cameron Dec 21, 2023
c510d6e
update
thomas-k-cameron Dec 21, 2023
7023641
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Dec 21, 2023
2b2403e
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Jan 22, 2024
d46c39e
Update format.py
thomas-k-cameron Jan 23, 2024
9b26849
Merge branch 'main' into RFC30/compiletime-benchmark-to-ci
thomas-k-cameron Feb 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,30 @@ jobs:
with:
action: check-aws-sdk-examples

compiletime-benchmark:
runs-on: ubuntu-latest
name: Run Compiletime Benchmark
needs: generate
permissions:
contents: read
id-token: write
pull-requests: write
outputs:
compiletime-benchmark: ${{ steps.compiletime-benchmark.outputs.compiletime-benchmark }}
steps:
- uses: actions/checkout@v3
with:
path: smithy-rs
ref: ${{ inputs.git_ref }}

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.rust_version }}

- name: run benchmark
id: run-compiletime-benchmark
run: bash smithy-rs/tools/compiletime-benchmark/script

# Pseudo-job that depends on matrix jobs so that we don't have to enter
# the myriad of test matrix combinations into GitHub's protected branch rules
require-all:
Expand Down
51 changes: 51 additions & 0 deletions tools/compiletime-benchmark/format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

import itertools


def main():
markdown = parser()

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


def parser() -> str:
# read file
f = open("/tmp/compiletime-benchmark.txt", "r").read()
iter = map(lambda x: x.split("END"), f.split("START"))
iter = itertools.chain.from_iterable(iter)

# I could've used a dataframe like pandas but this works.
markdown_rows = [
"| sdk name | dev | release | dev all features | release all features |",
"| -------- | --- | ------- | ---------------- | -------------------- |",

]
for i in iter:
outputs = []
print(i)
for l in i.splitlines():
if not "+" in l:
outputs.append(l.replace("real", "").replace(" ", "", 16))

if len(outputs) != 6:
continue

row = f"|{'|'.join(outputs)}|".replace("||", "|")
markdown_rows.append(row)

markdown = "\n".join(markdown_rows)
print(markdown)

return markdown


if __name__ == '__main__':
main()
47 changes: 47 additions & 0 deletions tools/compiletime-benchmark/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
C_YELLOW='\033[1;33m'
C_RESET='\033[0m'
set -xe

cd smithy-rs
DIR=$PWD

function log_time() {
cargo clean
echo "$1"
cargo build
{ time $1; } &> tmp_time_log.txt
cat tmp_time_log.txt
cat tmp_time_log.txt | grep real >> /tmp/compiletime-benchmark.txt
}

function compile() {
cd $1 &&
export RUSTFLAGS="" &&
cargo build && # this is for downloading crates
cargo clean &&
log_time "cargo build" &&
log_time "cargo build --release" &&
export RUSTFLAGS="--cfg aws_sdk_unstable" &&
log_time "cargo build --all-features" &&
log_time "cargo build --release --all-features"
}

./gradlew :aws:sdk:assemble

for variable in $(dir "aws/sdk/build/aws-sdk/sdk"); do
echo $variable
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"
echo "END" &>> /tmp/compiletime-benchmark.txt
fi
done

cd $DIR
python3 tools/compiletime-benchmark/format.py