Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Feb 10, 2024
1 parent b4ea5d4 commit 6d65cb2
Show file tree
Hide file tree
Showing 92 changed files with 2,580 additions and 602 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
24 changes: 24 additions & 0 deletions .github/workflows/bencher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Bencher
on:
push:
branches:
- main

jobs:
benchmark_with_bencher:
name: Continuous Benchmarking with Bencher
runs-on: ubuntu-latest
env:
BENCHER_ADAPTER: rust_bench
BENCHER_PROJECT: wtx
BENCHER_TESTBED: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bencherdev/bencher@main
- name: Track Benchmarks with Bencher
run: |
bencher run \
--branch "$GITHUB_REF_NAME" \
--err \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
"cargo bench --all-features"
36 changes: 36 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy docs
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Test and Build Book
run: |
cd wtx-docs && mdbook test && mdbook build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'wtx-docs/book'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml → .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Tests
on:
pull_request:
push:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
**/artifacts
**/corpus
**/target
**/target
**/target
profile.json
wtx-docs/book
4 changes: 2 additions & 2 deletions .scripts/autobahn-fuzzingclient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ fi;

## fuzzingclient

cargo build --bin autobahn-server --features atoi,flate2,simdutf8,tokio,web-socket-handshake --release
cargo run --bin autobahn-server --features atoi,flate2,simdutf8,tokio,web-socket-handshake --release & cargo_pid=$!
cargo build --bin autobahn-server --features atoi,flate2,simdutf8,tokio,web-socket-handshake --profile bench
cargo run --bin autobahn-server --features atoi,flate2,simdutf8,tokio,web-socket-handshake --profile bench & cargo_pid=$!
mkdir -p .scripts/autobahn/reports/fuzzingclient
podman run \
-p 9070:9070 \
Expand Down
4 changes: 2 additions & 2 deletions .scripts/autobahn-fuzzingserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ "$ARG" != "ci" ]; then
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
fi;

cargo build --bin autobahn-client --features atoi,flate2,simdutf8,tokio,web-socket-handshake --release
cargo build --bin autobahn-client --features atoi,flate2,simdutf8,tokio,web-socket-handshake --profile bench
mkdir -p .scripts/autobahn/reports/fuzzingserver
podman run \
-d \
Expand All @@ -16,7 +16,7 @@ podman run \
--net=host \
docker.io/crossbario/autobahn-testsuite:0.8.2 wstest -m fuzzingserver -s fuzzingserver.json
sleep 5
cargo run --bin autobahn-client --features atoi,flate2,simdutf8,tokio,web-socket-handshake --release
cargo run --bin autobahn-client --features atoi,flate2,simdutf8,tokio,web-socket-handshake --profile bench
podman rm --force --ignore fuzzingserver

if [ $(grep -ci "failed" .scripts/autobahn/reports/fuzzingserver/index.json) -gt 0 ]
Expand Down
3 changes: 2 additions & 1 deletion .scripts/internal-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ $rt test-with-features wtx tracing
$rt test-with-features wtx web-socket
$rt test-with-features wtx web-socket-handshake
$rt test-with-features wtx webpki-roots
$rt test-with-features wtx x509-certificate

$rt check-with-features wtx _bench
$rt check-with-features wtx _hack
Expand All @@ -101,7 +102,7 @@ cargo check --bin autobahn-server --features "flate2,web-socket-handshake"

cargo check --example database-client-postgres-tokio-rustls --features "_tokio-rustls-client,postgres"
cargo check --example web-socket-client-cli-raw-tokio-rustls --features "_tokio-rustls-client,web-socket-handshake"
cargo check --example web-socket-server-echo-raw-async-std --features "async-std/attributes,web-socket-handshake"
cargo check --example web-socket-server-echo-raw-async-std --features "async-std,web-socket-handshake"
cargo check --example web-socket-server-echo-raw-glommio --features "glommio,web-socket-handshake"
cargo check --example web-socket-server-echo-raw-smol --features "smol,web-socket-handshake"
cargo check --example web-socket-server-echo-raw-tokio --features "tokio,web-socket-handshake"
Expand Down
2 changes: 1 addition & 1 deletion .scripts/wtx-bench-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -euxo pipefail

RUSTFLAGS="-Ctarget-cpu=native" cargo run --bin wtx-bench --release -- postgres postgres://wtx_md5:wtx@localhost:5432/wtx
RUSTFLAGS="-Ctarget-cpu=native" cargo run --bin wtx-bench --profile bench -- postgres postgres://wtx_md5:wtx@localhost:5432/wtx
43 changes: 17 additions & 26 deletions .scripts/wtx-bench-web-socket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,30 @@ pushd /tmp
git clone https://github.com/c410-f3r/tokio-tungstenite || true
cd tokio-tungstenite
git checkout -t origin/bench || true
RUSTFLAGS="$FLAGS" cargo build --example echo-server --release
RUSTFLAGS="$FLAGS" cargo run --example echo-server --release 127.0.0.1:8081 &

cd /tmp
git clone --recursive https://github.com/c410-f3r/uWebSockets.git || true
cd uWebSockets
git checkout -t origin/bench || true
if [ ! -e ./EchoServer ]
then
make examples
fi
./EchoServer 8082 &
RUSTFLAGS="$FLAGS" cargo build --example echo-server --profile bench
RUSTFLAGS="$FLAGS" cargo run --example echo-server --profile bench 127.0.0.1:8081 &
popd

RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-async-std --features atoi,async-std/attributes,simdutf8,web-socket-handshake --release
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-async-std --features atoi,async-std/attributes,simdutf8,web-socket-handshake --release 127.0.0.1:8083 &
FEATURES="atoi,memchr,simdutf8,web-socket-handshake"

RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-async-std --features "async-std,$FEATURES" --profile bench
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-async-std --features "async-std,$FEATURES" --profile bench 127.0.0.1:8082 &

RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-glommio --features atoi,glommio,simdutf8,web-socket-handshake --release
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-glommio --features atoi,glommio,simdutf8,web-socket-handshake --release 127.0.0.1:8084 &
RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-glommio --features "glommio,$FEATURES" --profile bench
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-glommio --features "glommio,$FEATURES" --profile bench 127.0.0.1:8083 &

RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-smol --features atoi,simdutf8,smol,web-socket-handshake --release
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-smol --features atoi,simdutf8,smol,web-socket-handshake --release 127.0.0.1:8085 &
RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-smol --features "smol,$FEATURES" --profile bench
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-smol --features "smol,$FEATURES" --profile bench 127.0.0.1:8084 &

RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-tokio --features atoi,simdutf8,tokio,web-socket-handshake --release
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-tokio --features atoi,simdutf8,tokio,web-socket-handshake --release 127.0.0.1:8086 &
RUSTFLAGS="$FLAGS" cargo build --example web-socket-server-echo-raw-tokio --features "tokio,$FEATURES" --profile bench
RUSTFLAGS="$FLAGS" cargo run --example web-socket-server-echo-raw-tokio --features "tokio,$FEATURES" --profile bench 127.0.0.1:8085 &

sleep 1

RUSTFLAGS="$FLAGS" cargo run --bin wtx-bench --release -- \
RUSTFLAGS="$FLAGS" cargo run --bin wtx-bench --profile bench -- \
web-socket \
http://127.0.0.1:8081/tokio-tungstenite \
http://127.0.0.1:8082/uWebSockets \
http://127.0.0.1:8083/wtx-raw-async-std \
http://127.0.0.1:8084/wtx-raw-glommio \
http://127.0.0.1:8085/wtx-raw-smol \
http://127.0.0.1:8086/wtx-raw-tokio
http://127.0.0.1:8082/wtx-raw-async-std \
http://127.0.0.1:8083/wtx-raw-glommio \
http://127.0.0.1:8084/wtx-raw-smol \
http://127.0.0.1:8085/wtx-raw-tokio
Loading

0 comments on commit 6d65cb2

Please sign in to comment.