mirror of
https://github.com/status-im/nim-chronos.git
synced 2026-08-27 13:01:12 +00:00
The http client currently uses an inefficient byte-by-byte copy in its `BoundedStreamReader` - the real solution here is to get rid of the copy completely but until then, we can use bulk-copy the data at least. Ditto `read`, `readN` and similar helpers - this ~doubles throughput for bulk reading. Pre: ``` | Small/small | 0.070s | 1000 | 14226.009 | 0.031 MB | 0.016 MB | 0.434 MB/s | 0.231 MB/s | | Medium/small | 1.834s | 1000 | 545.267 | 1000.000 MB | 0.021 MB | 545.267 MB/s | 0.011 MB/s | | Small/Medium | 2.238s | 1000 | 446.735 | 0.031 MB | 1000.000 MB | 0.014 MB/s | 446.735 MB/s | | Medium/Medium | 2.583s | 1000 | 387.196 | 1000.000 MB | 1000.000 MB | 387.196 MB/s | 387.196 MB/s | ``` Post: ``` | Small/small | 0.066s | 1000 | 15038.890 | 0.031 MB | 0.016 MB | 0.459 MB/s | 0.244 MB/s | | Medium/small | 0.954s | 1000 | 1048.475 | 1000.000 MB | 0.021 MB | 1048.475 MB/s | 0.022 MB/s | | Small/Medium | 1.264s | 1000 | 791.318 | 0.031 MB | 1000.000 MB | 0.024 MB/s | 791.318 MB/s | | Medium/Medium | 1.615s | 1000 | 619.083 | 1000.000 MB | 1000.000 MB | 619.083 MB/s | 619.083 MB/s | ```