httpcore icon indicating copy to clipboard operation
httpcore copied to clipboard

Use `asyncio` synchronization instead of `anyio`

Open MarkusSintonen opened this issue 8 months ago • 32 comments

Summary

First PR in series of optimizations to improve performance of httpcore and even reach performance levels of aiohttp. Related discussion https://github.com/encode/httpx/issues/3215#issuecomment-2157885121

Previously: old1

With PR: new1

Request latency is more stable and the overall duration of the benchmark improves by 3.5x.

The difference diminishes when server latency increases over 100ms or so.

Checklist

  • [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [x] I've updated the documentation accordingly.

MarkusSintonen avatar Jun 10 '24 13:06 MarkusSintonen