New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpRequest.connectionInfo & HttpServer performance #31092

Open
joeconwaystk opened this Issue Oct 12, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@joeconwaystk

joeconwaystk commented Oct 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment