From cff9b44a7f64037538a7574ceb9155ac5c8ebcc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Wed, 12 Aug 2020 00:28:03 +0200 Subject: [PATCH] move RUSTFLAGS gen to own file instead of setting in each script --- TODO.md | 1 - scripts/bench-udp-handlers.sh | 8 +------- .../criterion/aquatic-http-announce-response-to-bytes.sh | 2 +- scripts/criterion/aquatic-http-request-from-bytes.sh | 2 +- .../criterion/aquatic-ws-deserialize-announce-request.sh | 8 +------- scripts/env-native-cpu-without-avx-512 | 9 +++++++++ scripts/run-aquatic-http.sh | 2 +- scripts/run-aquatic-udp.sh | 8 +------- scripts/run-load-test-http.sh | 8 +------- scripts/run-load-test-udp.sh | 8 +------- scripts/run-load-test-ws.sh | 8 +------- 11 files changed, 18 insertions(+), 46 deletions(-) create mode 100644 scripts/env-native-cpu-without-avx-512 diff --git a/TODO.md b/TODO.md index 090ae2f..008d0cb 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,6 @@ ## General -* rustflags for scripts in own .env file or similar * automatic tests running real clients in container? ## aquatic_http_load_test diff --git a/scripts/bench-udp-handlers.sh b/scripts/bench-udp-handlers.sh index df9b9ce..f273454 100755 --- a/scripts/bench-udp-handlers.sh +++ b/scripts/bench-udp-handlers.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_udp_bench -- $@ \ No newline at end of file diff --git a/scripts/criterion/aquatic-http-announce-response-to-bytes.sh b/scripts/criterion/aquatic-http-announce-response-to-bytes.sh index a5ed350..9785363 100755 --- a/scripts/criterion/aquatic-http-announce-response-to-bytes.sh +++ b/scripts/criterion/aquatic-http-announce-response-to-bytes.sh @@ -3,7 +3,7 @@ set -e -export RUSTFLAGS="-C target-cpu=native" +. ./scripts/env-native-cpu-without-avx-512 cargo bench --bench bench_announce_response_to_bytes -- --noplot --baseline latest diff --git a/scripts/criterion/aquatic-http-request-from-bytes.sh b/scripts/criterion/aquatic-http-request-from-bytes.sh index 00d2589..4990a03 100755 --- a/scripts/criterion/aquatic-http-request-from-bytes.sh +++ b/scripts/criterion/aquatic-http-request-from-bytes.sh @@ -3,7 +3,7 @@ set -e -export RUSTFLAGS="-C target-cpu=native" +. ./scripts/env-native-cpu-without-avx-512 cargo bench --bench bench_request_from_bytes -- --noplot --baseline latest diff --git a/scripts/criterion/aquatic-ws-deserialize-announce-request.sh b/scripts/criterion/aquatic-ws-deserialize-announce-request.sh index 3ed70dd..48dbc01 100755 --- a/scripts/criterion/aquatic-ws-deserialize-announce-request.sh +++ b/scripts/criterion/aquatic-ws-deserialize-announce-request.sh @@ -3,13 +3,7 @@ set -e -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo bench --bench bench_deserialize_announce_request -- --noplot --baseline latest diff --git a/scripts/env-native-cpu-without-avx-512 b/scripts/env-native-cpu-without-avx-512 new file mode 100644 index 0000000..68f7751 --- /dev/null +++ b/scripts/env-native-cpu-without-avx-512 @@ -0,0 +1,9 @@ +#!/bin/sh + +# Compile with target-cpu=native but without AVX512 features, since they +# decrease performance. + +DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | + awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) + +export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" \ No newline at end of file diff --git a/scripts/run-aquatic-http.sh b/scripts/run-aquatic-http.sh index 343b6de..495a259 100755 --- a/scripts/run-aquatic-http.sh +++ b/scripts/run-aquatic-http.sh @@ -1,5 +1,5 @@ #!/bin/sh -. scripts/env-native-cpu-wihout-avx-512 +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_http -- $@ diff --git a/scripts/run-aquatic-udp.sh b/scripts/run-aquatic-udp.sh index 57f27f3..6ccfb86 100755 --- a/scripts/run-aquatic-udp.sh +++ b/scripts/run-aquatic-udp.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_udp -- $@ diff --git a/scripts/run-load-test-http.sh b/scripts/run-load-test-http.sh index e8d1a24..86edc66 100755 --- a/scripts/run-load-test-http.sh +++ b/scripts/run-load-test-http.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_http_load_test -- $@ \ No newline at end of file diff --git a/scripts/run-load-test-udp.sh b/scripts/run-load-test-udp.sh index 90f30cc..3946878 100755 --- a/scripts/run-load-test-udp.sh +++ b/scripts/run-load-test-udp.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_udp_load_test -- $@ diff --git a/scripts/run-load-test-ws.sh b/scripts/run-load-test-ws.sh index c1adfa0..823c195 100755 --- a/scripts/run-load-test-ws.sh +++ b/scripts/run-load-test-ws.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Compile with target-cpu=native but without AVX512 features, since they -# decrease performance. - -DISABLE_AVX512=$(rustc --print target-features | grep " avx512" | - awk '{print $1}' | sed 's/^/-C target-feature=-/' | xargs) - -export RUSTFLAGS="-C target-cpu=native $DISABLE_AVX512" +. ./scripts/env-native-cpu-without-avx-512 cargo run --release --bin aquatic_ws_load_test -- $@ \ No newline at end of file