Description
Some profiling revealed an interesting performance issue. In a simple HttpServer
application that invokes HttpRequest.connectionInfo
, >10% of execution time is spent in that method. Source reveals that this method is invoking the platform getpeerbyname
function, so I doubt there is anything that can be done there. Except that for each access of HttpRequest.connectionInfo
, a new instance is created and getpeerbyname
is called again. Some caching or a warning in the docs may suffice. Someone might write code such this becomes a serious performance issue without knowing, e.g.:
logger.info("${request.connectionInfo.remoteAddress}:${request.connectionInfo.remotePort}");
Another item - didn't want to create 2 issues - came up in the dart misc group. Someone put together some benchmarking on simple HTTP servers on a few platforms (https://github.com/costajob/app-servers). Dart is near the bottom of that list in performance, even when distributing across isolates. I've attached the top of the CPU profile at the bottom. One thing I find interesting - and that you can't see in the screenshot - is just how deep the stack is when writing bytes.