mirror of
https://github.com/simonw/datasette.git
synced 2026-11-05 17:58:30 +01:00
Tools for profiling Datasette's request/response cycle in-process with Python 3.15's profiling.sampling, plus the patches proposed by the study (one per optimisation, and ALL-combined.diff). The patches are not applied to the code. A report with measurements follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F8mEgRS8swZfYqwqrVMeo5
14 lines
550 B
Diff
14 lines
550 B
Diff
diff --git a/datasette/views/base.py b/datasette/views/base.py
|
|
index 7262edb..f2d63aa 100644
|
|
--- a/datasette/views/base.py
|
|
+++ b/datasette/views/base.py
|
|
@@ -335,4 +335,9 @@ async def stream_csv(datasette, fetch_data, request, database):
|
|
)
|
|
headers["content-disposition"] = disposition
|
|
|
|
+ if request.method == "HEAD":
|
|
+ # A HEAD response has no body, so don't generate (and paginate) the CSV
|
|
+ async def stream_fn(r):
|
|
+ pass
|
|
+
|
|
return AsgiStream(stream_fn, headers=headers, content_type=content_type)
|