Re: [whatwg/streams] batched TransformStream transform()? (#574)

In the case of fixed-block-size transforms, like encryption, I don't think it helps that much. Even if we provide a minimum total size, the transformer still has to deal with the case where they receive data that is not an exact multiple of the block size. So what they'll end up doing is storing an array of chunks from the last call to transform() that haven't been used yet (or keep a copy of the data in their own buffer). Once you've got that data structure it's trivial to add new chunks of data to it if you don't have enough to process a block yet. So the minimal total size ends up being not that helpful.

A way to say "feed me exactly 1024 bytes at a time, no more, no less" would solve this problem but seems a bit exotic. What I mean by "exotic" is that it solves a specific problem for one particular use-case but is useless for everyone else.

I think it would be natural to look at this again when #27 ("the writev problem") is resolved. If we have batched writes then the case for batched transforms become a lot more compelling.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/574#issuecomment-256937195

Received on Friday, 28 October 2016 14:37:31 UTC