async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

7% of the overall runtime spent in `SelectableEventLoop.debugDescription`

Open weissi opened this issue 1 year ago • 0 comments

Just noticed that when just running loads of sequential super basic HTTP requests against a fast server (NIOHTTP1Server), we spent about 7% of the overall runtime in HTTP1ClientChannelHandler.request.setter which spends most of its time in _print_unlocked<A, B>(_:_:) because it's pulling a debugDescription for EventLoop for the logger metadata :P (release mode compile of course)

Should be an easy fix.

https://github.com/swift-server/async-http-client/blob/54d1006dc90b9ee77b4d04d63ad8688d2215dc1e/Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ClientChannelHandler.swift#L39

Screenshot 2024-07-23 at 11 55 05 am

FWIW, the super basic perf test I used is this: https://github.com/weissi/async-http-client/commit/bf7dbeb933433bc111942808ec5ed9108c44be72 (this code isn't meant to be merged).

weissi avatar Jul 23 '24 10:07 weissi