Skip to content

HttpRequest.connectionInfo & HttpServer performance #31092

Open
@itsjoeconway

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.

screen shot 2017-10-12 at 2 53 12 pm

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-io

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions