Skip to content

Instantly share code, notes, and snippets.

@nekufa
Created March 3, 2023 11:30
Show Gist options
  • Save nekufa/fbc238d0561d31dbf8224b90b96df449 to your computer and use it in GitHub Desktop.
Save nekufa/fbc238d0561d31dbf8224b90b96df449 to your computer and use it in GitHub Desktop.
class Response:
data: list
async def get_data():
# we have 250k rows of lists with 7 tuples - str and int
return []
async def handler_empty():
await get_data(); # 2 sec
return {'data': []} # 0 sec
async def handler_render_json():
return {'data': await get_data()} # 5 sec
async def handler_render_response():
return Response(data=await get_data()) # 8sec
async def handler_render_response_with_typed_result() -> Response:
return Response(data=await get_data()) # 12sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment