Skip to content
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

HttpServer and HttpClient are slow at processing HTTPS data #54752

Closed
Tienisto opened this issue Jan 28, 2024 · 3 comments
Closed

HttpServer and HttpClient are slow at processing HTTPS data #54752

Tienisto opened this issue Jan 28, 2024 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io

Comments

@Tienisto
Copy link
Contributor

Tienisto commented Jan 28, 2024

HttpClient and HttpServer are slow at processing large binary data when HTTPS is enabled.

I have created a repository to test this: https://github.com/Tienisto/httpserver-benchmark

In general, the HTTP performance is fine. But there is a strange behaviour when dealing with encryption (HTTPS).
Dart is much slower than Node.js which is actually noticable in one of my projects: localsend/localsend#384 where someone even created a Rust backend because of the poor Dart performance: https://github.com/tom8zds/localsend_rs

On Windows or macOS, this is not really noticable because they are often fast enough so that the bandwidth is the bottleneck (and not Dart).
On Android or older iPhones however, this is definitely noticable.

Here are the results (they ran on a M2 chip):

HTTP

Client Server Speed (more is better) Factor
Dart Dart 1641 MB/s 1x
Node.js Dart 1655 MB/s 1x
Dart Node.js 2270 MB/s 1.38x
Node.js Node.js 2177 MB/s 1.33x

HTTPS

Client Server Speed (more is better) Factor
Dart Dart 170 MB/s 1x
Node.js Dart 158 MB/s 0.92x
Dart Node.js 272 MB/s 1.6x
Node.js Node.js 1228 MB/s 7.22x
@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels Jan 28, 2024
@mraleph
Copy link
Member

mraleph commented Jan 29, 2024

Duplicate of #54009

@mraleph mraleph marked this as a duplicate of #54009 Jan 29, 2024
@mraleph mraleph closed this as completed Jan 29, 2024
@mraleph
Copy link
Member

mraleph commented Jan 29, 2024

Let's take discussion there.

@Tienisto
Copy link
Contributor Author

I have created rhttp that can be used in the mean time. Currently, it requires Flutter but if #50565 is resolved, this package can be used in native Dart also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

3 participants