httpcore icon indicating copy to clipboard operation
httpcore copied to clipboard

Add `asyncio` backend

Open MarkusSintonen opened this issue 8 months ago • 12 comments

Summary

Adds back native asyncio backend based on commit where it was removed here. Adjusts it to work with the new interfaces. This also adds some additional integration testing.

Doesn't make the new backend the default.

AnyIO has considerable overhead so this allows again using the native backend. Also this is going to allow removal of the AnyIO as the dependency (when the synchronization PR goes in also).

Overhead is about 1.45x here (the synchronization has a lot more overhead in the other PR).

Previously (is master): old

Now: asyncio

Related discussion https://github.com/encode/httpx/issues/3215#issuecomment-2155630018.

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 16 '24 18:06 MarkusSintonen