Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfs: added fs.writev() which exposes syscalls writev() #25925
Conversation
nodejs-github-bot
added
doc
fs
tools
labels
Feb 4, 2019
This comment has been minimized.
This comment has been minimized.
|
I don't understand why if a single buffer object is passed, it would be split up in chunks just to use |
This comment has been minimized.
This comment has been minimized.
|
@mscdex I am trying to support all types that are supported by fs.write(). Do you think it's a good idea to just support buffer[] as an input? |
This comment has been minimized.
This comment has been minimized.
I don't see a reason to restrict it like that. Any data type supported by the language or node.js that stores binary data should be allowed IMO. On another note, I think if we are going to support strings, I think it might be better to support them on the C++ side like we do for socket writev to avoid having to possibly cross the JS/C++ boundary for each string. One thing that you might want to benchmark though with that C++ implementation is whether it'd be faster to do the |
addaleax
added
semver-minor
and removed
tools
labels
Feb 4, 2019
This comment has been minimized.
This comment has been minimized.
|
I would suggest supporting |
This comment has been minimized.
This comment has been minimized.
AnasAboureada
force-pushed the
AnasAboureada:expose-syscall-writev-to-fs
branch
from
1519909
to
9a39133
Feb 6, 2019
| @@ -591,6 +604,36 @@ function writeSync(fd, buffer, offset, length, position) { | |||
| return result; | |||
| } | |||
|
|
|||
| // usage: | |||
| // fs.writev(fd, buffers, [position], callback); | |||
| function writev(fd, buffer, position, callback) { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mscdex
Feb 6, 2019
Contributor
The parameter name should be buffers to match the comment and the intention.
AnasAboureada
force-pushed the
AnasAboureada:expose-syscall-writev-to-fs
branch
from
2e3f895
to
137dbcb
Feb 6, 2019
AnasAboureada
force-pushed the
AnasAboureada:expose-syscall-writev-to-fs
branch
from
137dbcb
to
35e8aa8
Feb 7, 2019
This comment has been minimized.
This comment has been minimized.
|
I think we should probably also add |
AnasAboureada commentedFeb 4, 2019
fs with writev allow many buffers to be pushed to underlying OS
APIs in one batch, so this should improve write speed to files.
I have tried to follow the old fs.write() function signature
and make all the features of it available when users use fs.writev()
Fixes: #2298
: expose-syscall-writev-to-fs
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes