Switch to Weft and document laptop performance environment

Commit b7e6326 · patx · 2026-10-14T23:38:58-04:00

Changeset
b7e63261c77bfde49e8efe4f88c4d89632de0b6d
Parents
f2b7d044793700ebcfe3a044cbea02f93075a542

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/README.md b/README.md
index 4eb63fb..1166873 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Your API needs to return some JSON. It probably doesn't need a goddamn cathedral
 - Headers, query parameters, cached body reads, and JSON parsing.
 - JSON responses, custom response tuples, and a small-file helper.
 - Callable ASGI response support and routing relative to mounted paths.
-- Depends on `peregrine-server` and `orjson`. You can use any ASGI server.
+- Depends on `weft-server` and `orjson`. You can use any ASGI server.
 
 ## What you don't get
 
@@ -43,10 +43,10 @@ async def hello(request):
     return {'hello': 'world'}
 ```
 
-Run it with Peregrine, or any other ASGI server you like:
+Run it with Weft, or any other ASGI server you like:
 
 ```bash
-peregrine app:app
+weft app:app
 ```
 
 Open <http://127.0.0.1:8000>. Wred is HTTP-only.
@@ -166,18 +166,13 @@ JSON 400 responses: `{'error': message}`. Raise `WredRequestError` from a handle
 for application validation failures. Unsupported response types produce JSON
 500 errors; other exceptions propagate.
 
-## Benchmarks
+## Performance
 
-`GET /` returning `{"hello": "world"}`. Three runs per framework, rotating their order each round.
+Since there isn't much to Wred, it's really fast. What it lacks in features it gains in speed.
 
-| Framework | Median requests/sec | Min | Max |
-| --- | ---: | ---: | ---: |
-| Wred 0.04 | **553,296** | 544,314 | 585,634 |
-| BlackSheep 2.6.4 | 398,900 | 384,661 | 415,871 |
-| MicroPie 0.32 | 374,680 | 367,513 | 391,136 |
-
-Python 3.14.4, Peregrine 1.1.7, eight workers, HTTP/1 keep-alive, asyncio,
-no access logging. `wrk -t4 -c256 -d20s --latency`, five-second warmups.
-Client and server shared a machine over loopback. All nine measured runs
-had zero socket errors or non-success responses. It's a tiny JSON response,
-not your whole application. Benchmark your own shit.
+Wred running on Weft with 8 workers achieved up to 579,708 requests/second, averaging
+approximately 479,414 requests/second across five benchmark runs. Testing was performed
+locally using wrk with 4 threads, 256 concurrent connections, and 20-second runs, with
+an average p99 latency of just 3.69 ms. Testing was done on a Dell XPS 13 9350 with
+an Intel Core Ultra 7 256V (8 cores, up to 4.8 GHz), running Ubuntu 26.04.1 LTS
+(Linux 6.17.0-1023-oem, x86-64).
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..f3e17f6
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,22 @@
+# [Wred](https://harrisonerd.com/wred) is a fast, composable Python backend for JavaScript web apps. View the documentation and source [here](https://gitman.io/patx/wred).
+
+## Installation
+
+```bash
+$ pip install wred
+```
+
+## Quick Start
+
+```python
+from wred import App
+
+app = App()
+
[email protected]("/")
+async def index(request):
+    return {"hello": "world"}
+
+# save as `app.py`
+# run with `weft app:app`
+```
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index 64d6a58..6fae45f 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -46,7 +46,7 @@ app = App()
 async def index(request):
     return {"hello": "world"}
 
-# run with `peregrine app:app`
+# run with `weft app:app`
 </code></pre>
     </section>
   </main>
diff --git a/example_app/app.py b/example_app/app.py
index dff40ab..1d271ff 100644
--- a/example_app/app.py
+++ b/example_app/app.py
@@ -1,7 +1,7 @@
 """Run the notebook demo from the repository root:
 
     uv sync
-    uv run peregrine example_app.app:app
+    uv run weft example_app.app:app
 
 Open http://127.0.0.1:8000. Users, tokens, and notes disappear on restart.
 Login is restored with an HttpOnly refresh cookie; API calls use bearer tokens.
diff --git a/pyproject.toml b/pyproject.toml
index 779eab4..7d60272 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,10 +6,10 @@ build-backend = "flit_core.buildapi"
 name = "wred"
 dynamic = ["version"]
 description = "An ultra-minimal ASGI framework for JSON APIs."
-readme = "README.md"
+readme = "docs/README.md"
 requires-python = ">=3.11"
 license = "BSD-3-Clause"
 license-files = ["LICENSE"]
 authors = [{ name = "Harrison Erd", email = "[email protected]" }]
-dependencies = ["orjson", "peregrine-server"]
+dependencies = ["orjson", "weft-server"]
 
diff --git a/wred.py b/wred.py
index c73feca..2aa8788 100644
--- a/wred.py
+++ b/wred.py
@@ -10,7 +10,7 @@ Copyright (c) 2026, Harrison Erd.
 
 __author__ = 'Harrison Erd'
 __email__ = '[email protected]'
-__version__ = '0.04'
+__version__ = '0.05'
 __license__ = 'BSD-3-Clause'
 
 from collections.abc import Awaitable, Callable