Description
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 |