Skip to content

Proposal for two micro-optimzations in RequestHandler.start function #2604

Closed
@pfreixes

Description

Basically, I would like to work on two different micro-optimizations to speed up a bit, arround 5% and 10% overall, for the most costly function RequestHandler.start. I would like to gather your feedback before start working on them.

  1. Handle most of the keepalive logic outside of the RequestHandler.start, and leave there only the none happy path - when the keep alive has to be canceled. This will save us to execute a few opcodes and many time syscalls. [1]

  2. Get rid of the set_tcp_cork and set_tcp_nodelay operations and provide an API to be used by the internal layer that guarantees that a code path that touches any TCP configuration sets back the original values, this might be implemented using a context. [2]

I know that I might be missing something that would avoid implementing this two micro-optimizations, hence please feedback will be more than appreciate

[1] https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_protocol.py#L476
[2] https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_protocol.py#L426

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions