Open gzak opened 4 years ago
Well then...
Last question before I close, is zero-copy usually restricted to file->network transfers only? What about transferring bits between arbitrary streams (file->file, for example)?
But I don't think that's a zero-copy type of API. From what I can see it copies bytes from one stream into the heap, then sends the bytes back out to the other stream. I would imagine a zero-copy version to be "direct" - maybe that's not possible in general, only for file->socket use cases?
No it’s not possible in the general case. CopyToAsync is the closest you can get to though. It’s optimized on most stream implementations to do the minimal amount of work.
Need Zero-copy, Support hight data transmission for .Net core .
Usually to move things like this forward, we need an API proposal with some motivating scenarios that somebody can champion and push forward. Otherwise issues like this aren't looked at by the team until a motivating scenario comes up.
I'm asking in https://github.com/dotnet/runtime/issues/46848, but not get the answer for file to file
copy.
until I find this article.
https://www.cnblogs.com/z-sm/p/6547709.html
it seems Java's FileChannel
have the ablity to do disk to disk copy too, and they even can have position
and length
paramerters
and the oracle doc : https://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html
.NET has send file exposed, if you want something more specific, you have to be more specific. The reason issues like these are closed are because of a lack of evidence of a miscommunication about the scenario. Reading this dotnet/runtime#46848 I can understand why it got closed:
Here's an issue I filed about taking advantage of splice(2) to accomplish zero copy to unix pipe.
.NET Standard is complete, so I'm moving this to dotnet/runtime as a feature request.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @dotnet/area-system-io See info in area-owners.md if you want to be subscribed.
Author: | gzak |
---|---|
Assignees: | - |
Labels: | `area-System.IO`, `untriaged` |
Milestone: | - |
Add support for a zero-copy API, akin to java.nio.channels.FileChannel's transferTo() method.
General
It would be great if .NET had a built-in way of doing zero-copy steam transfers, especially for large blobs (like files). Most operating systems appear to support this, so it's just a matter of exposing some API to do this in .NET. By adding it to .NET standard, both .NET Core and .NET Framework can both benefit from this API.