@@ -124,7 +124,7 @@ def test_one_hundred_get_requests_with_512kib_chunked_payload(
124124 aiohttp_client : AiohttpClient ,
125125 benchmark : BenchmarkFixture ,
126126) -> None :
127- """Benchmark 100 GET requests with a payload of 512KiB."""
127+ """Benchmark 100 GET requests with a payload of 512KiB using read ."""
128128 message_count = 100
129129 payload = b"a" * (2 ** 19 )
130130
@@ -148,6 +148,36 @@ def _run() -> None:
148148 loop .run_until_complete (run_client_benchmark ())
149149
150150
151+ def test_one_hundred_get_requests_iter_chunks_on_512kib_chunked_payload (
152+ loop : asyncio .AbstractEventLoop ,
153+ aiohttp_client : AiohttpClient ,
154+ benchmark : BenchmarkFixture ,
155+ ) -> None :
156+ """Benchmark 100 GET requests with a payload of 512KiB using iter_chunks."""
157+ message_count = 100
158+ payload = b"a" * (2 ** 19 )
159+
160+ async def handler (request : web .Request ) -> web .Response :
161+ resp = web .Response (body = payload )
162+ resp .enable_chunked_encoding ()
163+ return resp
164+
165+ app = web .Application ()
166+ app .router .add_route ("GET" , "/" , handler )
167+
168+ async def run_client_benchmark () -> None :
169+ client = await aiohttp_client (app )
170+ for _ in range (message_count ):
171+ resp = await client .get ("/" )
172+ async for _ in resp .content .iter_chunks ():
173+ pass
174+ await client .close ()
175+
176+ @benchmark
177+ def _run () -> None :
178+ loop .run_until_complete (run_client_benchmark ())
179+
180+
151181def test_get_request_with_251308_compressed_chunked_payload (
152182 loop : asyncio .AbstractEventLoop ,
153183 aiohttp_client : AiohttpClient ,
0 commit comments