@@ -120,6 +120,41 @@ def _run() -> None:
120120 loop .run_until_complete (run_client_benchmark ())
121121
122122
123+ def test_five_get_requests_with_567296_compressed_chunked_payload (
124+ loop : asyncio .AbstractEventLoop ,
125+ aiohttp_client : AiohttpClient ,
126+ benchmark : BenchmarkFixture ,
127+ ) -> None :
128+ """Benchmark 5 compressed GET requests with a payload of 567296."""
129+ message_count = 5
130+ # This payload compresses poorly to ~567296 bytes.
131+ payload = (
132+ bytes (range (0 , 256 ))
133+ + bytes (range (255 , 0 , - 1 ))
134+ + bytes (range (0 , 128 ))
135+ + bytes (range (255 , 0 , - 1 ))
136+ ) * 1024
137+
138+ async def handler (request : web .Request ) -> web .Response :
139+ resp = web .Response (body = payload )
140+ resp .enable_compression ()
141+ return resp
142+
143+ app = web .Application ()
144+ app .router .add_route ("GET" , "/" , handler )
145+
146+ async def run_client_benchmark () -> None :
147+ client = await aiohttp_client (app )
148+ for _ in range (message_count ):
149+ resp = await client .get ("/" )
150+ await resp .read ()
151+ await client .close ()
152+
153+ @benchmark
154+ def _run () -> None :
155+ loop .run_until_complete (run_client_benchmark ())
156+
157+
123158def test_one_hundred_get_requests_with_1024_content_length_payload (
124159 loop : asyncio .AbstractEventLoop ,
125160 aiohttp_client : AiohttpClient ,
0 commit comments