You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The real issue is the first two. The solution is very simple: feature gate those methods of TorrentFile behind a Linux flag, and fallback to coalescing buffers and issuing a single write call for other platforms.
[update]: It may actually be better to create a fallback of the Piece::writemethod instead of the lower level TorrentFile::write method.
This is because the current piece write method allocates a temporary buffer of iovecs, which is only needed for the pwritev syscall. However, if we're coalescing buffers and issuing a single write, we can skip the iovecs allocation step and save an allocation and other additional logic. A little more work for better performance.
The text was updated successfully, but these errors were encountered:
That could be a future optimization for sure, but I think for now something simpler is enough. Besides, that solution would not fix incompatibility with mac/darwin/bsd, so someting more generic that is easy to maintain is better for now.
There's really no need to make cratetorrent Linux-only. The only places that rely on platform specific APIs are:
/tmp
in tests an examples.The real issue is the first two. The solution is very simple: feature gate those methods of
TorrentFile
behind a Linux flag, and fallback to coalescing buffers and issuing a single write call for other platforms.[update]: It may actually be better to create a fallback of the
Piece::write
method instead of the lower levelTorrentFile::write
method.This is because the current piece write method allocates a temporary buffer of iovecs, which is only needed for the
pwritev
syscall. However, if we're coalescing buffers and issuing a singlewrite
, we can skip the iovecs allocation step and save an allocation and other additional logic. A little more work for better performance.The text was updated successfully, but these errors were encountered: