From 2529ae71057fd4fbf6c815c96b04f6a41bac08f3 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Tue, 25 Feb 2025 13:31:54 +0000 Subject: [PATCH] update python example; sanic deps in flake.nix, measure_all.sh --- flake.nix | 1 + wrk/measure_all.sh | 6 +++++- wrk/python/main.py | 11 +++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 3fd3935..80b9232 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,7 @@ wrk python3 python3Packages.sanic + python3Packages.setuptools python3Packages.matplotlib poetry poetry diff --git a/wrk/measure_all.sh b/wrk/measure_all.sh index 0f5bb5b..0e80a59 100755 --- a/wrk/measure_all.sh +++ b/wrk/measure_all.sh @@ -8,13 +8,17 @@ fi SUBJECTS="$1" -if [ "$SUBJECTS" = "README" ] ; then +if [ "$SUBJECTS" = "README" ] ; then rm -f wrk/*.perflog SUBJECTS="zig-zap go python-sanic rust-axum csharp cpp-beast" + # above targets csharp and cpp-beast are out of date! + SUBJECTS="zig-zap go python-sanic rust-axum" fi if [ -z "$SUBJECTS" ] ; then SUBJECTS="zig-zap go python python-sanic rust-bythebook rust-bythebook-improved rust-clean rust-axum csharp cpp-beast" + # above targets csharp and cpp-beast are out of date! + SUBJECTS="zig-zap go python python-sanic rust-bythebook rust-bythebook-improved rust-clean rust-axum" fi for S in $SUBJECTS; do diff --git a/wrk/python/main.py b/wrk/python/main.py index 0e180fa..f3c77d1 100644 --- a/wrk/python/main.py +++ b/wrk/python/main.py @@ -7,10 +7,13 @@ serverPort = 8080 class MyServer(BaseHTTPRequestHandler): def do_GET(self): - self.send_response(200) - self.send_header("Content-type", "text/html") - self.end_headers() - self.wfile.write(bytes("HI FROM PYTHON!!!", "utf-8")) + try: + self.send_response(200) + self.send_header("Content-type", "text/html") + self.end_headers() + self.wfile.write(bytes("HI FROM PYTHON!!!", "utf-8")) + except: + pass def log_message(self, format, *args): return