Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More concrete examples of "optimization" of pipeTo #359

Open
tyoshino opened this issue May 29, 2015 · 3 comments
Open

More concrete examples of "optimization" of pipeTo #359

tyoshino opened this issue May 29, 2015 · 3 comments
Labels
Milestone

Comments

@tyoshino
Copy link
Member

Potential targets of optimization

Skipping JS processing between a ReadableByteStream and a WritableByteStream

Skip JS code invocation (write(), read(), etc.) and does the following internally.

Sink exposes a memory region for write

  1. destMemory = sink.getMemoryToWrite()
  2. source.generate(destMemory)
  3. sink.notifyWritten()

Source exposes a memory region where data for consuming is stored

  1. sourceMemory = source.getMemoryToRead()
  2. sink.consume(sourceMemory)
  3. source.notifyConsumed()

Both takes memory

  1. tempMemory = allocate()
  2. source.generate(tempMemory)
  3. sink.consume(tempMemory)

sendfile(2) style

  1. transfer(lowerLayerSourceDescriptor, lowerLayerSinkDescriptor)

Skipping an "identity" transform byte streams completely

a.pipeTo(id, options0);
id.pipeTo(b. options1);

Copy data from a to b directly.

Issues:

  • Thread-safety: a.pipeTo(id) and id.pipeTo(b) may happen in different threads.
  • How to observe bytes for ByteCountingIdentityTransformByteStream?
@tyoshino
Copy link
Member Author

We've decided to introduce isDisturbed, not byte counting system. So, we should reinvestigate how we set isDisturbed.

@tyoshino
Copy link
Member Author

Regarding how we realize postMessage()-ing streams #244, we should consider how to deal with invocation of an optimized pipeTo() logic for cross thread case.

@tyoshino
Copy link
Member Author

Please take a look at my strawman API for allowing pipeTo optimization at #511.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants