So, I'm going to change the interface internally to accept both a Writer or a WriterSync, then change the writes within a command to possibly return a promise. Doing a quick bench, conditionally awaiting the promise is 2x faster than always awaiting one.
The current use of
Deno.Reader
andDeno.WriteSync
internally is not working.The writes could be going to stuff like writable streams and there needs to be a way to get backpressure.
Deno.WriteSync
was used because it's fast and worked ok with the initial design, but it doesn't work well withWritableStream
s, which must be async.https://github.com/dsherret/dax/blob/c885ba58ba52035a6cf99629dbcac90209a94604/src/command.ts#L840
So, I'm going to change the interface internally to accept both a
Writer
or aWriterSync
, then change the writes within a command to possibly return a promise. Doing a quick bench, conditionally awaiting the promise is 2x faster than always awaiting one.