diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-16 23:08:57 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-16 23:08:57 +0100 |
commit | 7fd73dff220f7dd5075884059f1c4edc88036813 (patch) | |
tree | ed3c758152ea78011331b49b1191e499b6ae3372 /src/local | |
parent | 1e81fdf28bcd25c5fb1c2638b74ddb9d51bd5b72 (diff) | |
download | chawan-7fd73dff220f7dd5075884059f1c4edc88036813.tar.gz |
io: add BuferedWriter
Unsurprisingly enough, calling `write` a million times is never going to be very fast. BufferedWriter basically does the same thing as serialize.swrite did, but queues up writes in batches before sending them. TODO: give sread a similar treatment
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/client.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/local/client.nim b/src/local/client.nim index 5c93e375..8633d051 100644 --- a/src/local/client.nim +++ b/src/local/client.nim @@ -21,9 +21,9 @@ import html/event import html/formdata import html/xmlhttprequest import io/bufstream +import io/bufwriter import io/posixstream import io/promise -import io/serialize import io/socketstream import js/base64 import js/console @@ -489,7 +489,8 @@ proc acceptBuffers(client: Client) = pager.alert("Error: failed to set up buffer") continue let key = pager.addLoaderClient(container.process, container.loaderConfig) - stream.swrite(key) + stream.withWriter w: + w.swrite(key) let loader = pager.loader if item.fdin != -1: let outputId = item.istreamOutputId |