On Sat, Feb 2, 2013 at 6:05 PM, Zoid <[email protected]> wrote:
> Hi
>
> I found that with 0.9.7 on Windows streams created by fs.createWriteStream()
> don't save syscalls: you get as many systalls as write() calls. It leads to
> mediocre file write performance.
>
> Here is demonstration code: http://hpaste.org/81687
>
> Run it, then notice that number of IO writes in TaskManager coincides with
> the totalCount displayed.
>
> If it is by design, the documentation should state that application-level
> write buffering must be implemented to achieve reasonable write performance.
>
> Andy

Are you reporting that as a regression in 0.9.x or as a general observation?

I rewrote your test case to make it work with master and v0.8.  It's
interesting that compared to v0.8, master:

a) calls write() 51.8% less, but
b) takes 2.15x as long to complete, and
c) has a peak RSS that's 3.9x higher

I've raised an issue: https://github.com/joyent/node/issues/4706

(strace numbers are with N=1e5 because I didn't want to wait all night.)

$ strace -cfe write v0.8/out/Release/node writestream.js
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00    0.005992           0    300001           write
------ ----------- ----------- --------- --------- ----------------
100.00    0.005992                300001           total

$ strace -cfe write master/out/Release/node writestream.js
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00    0.004116           0    147462           write
------ ----------- ----------- --------- --------- ----------------
100.00    0.004116                147462           total

$ /usr/bin/time v0.8/out/Release/node writestream.js
11.89user 6.35system 0:13.95elapsed 130%CPU (0avgtext+0avgdata
54976maxresident)k
0inputs+3912outputs (0major+3917minor)pagefaults 0swaps

$ /usr/bin/time master/out/Release/node writestream.js
30.74user 4.77system 0:30.33elapsed 117%CPU (0avgtext+0avgdata
213216maxresident)k
0inputs+3848outputs (0major+13475minor)pagefaults 0swaps

$ cat writestream.js
var N = 1e6;
var n = 0;
var f = require('fs').createWriteStream('jo');
f.on('drain', foo);
foo();
function foo()
{
        var count = 0;
        while (++count < N && f.write('aa'));
  n += count;
  if (n >= N) process.exit();
}

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to