nodejs / node-v0.x-archive

Moved to https://github.com/nodejs/node
34.42k stars 7.31k forks source link

test/pummel/test-https-large-response.js 2x slower with --use-uv #1643

Closed ry closed 13 years ago

ry commented 13 years ago

reported by @koichik here https://github.com/joyent/node/issues/602#issuecomment-1987853

preliminary profiles on osx inconclusive http://tinyclouds.org/https-large-response-uv.png http://tinyclouds.org/https-large-response-legacy.png suspect the 1mb slab in stream_wrap.cc is somehow responsible

koichik commented 13 years ago

When I comment out pause()/resume(), libuv is a bit faster than legacy.

$ git diff HEAD -- test/pummel/test-https-large-response.js
diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-l
index b1e308a..23fd184 100644
--- a/test/pummel/test-https-large-response.js
+++ b/test/pummel/test-https-large-response.js
@@ -59,10 +59,10 @@ server.listen(common.PORT, function () {
     res.on('data', function(d) {
       process.stdout.write('.');
       count += d.length;
-      res.pause();
-      process.nextTick(function () {
-        res.resume();
-      });
+      //res.pause();
+      //process.nextTick(function () {
+      //  res.resume();
+      //});
     });

     res.on('end', function(d) {
$ time ./node test/pummel/test-https-large-response.js
build body...done
got request
response!
......................................................................................................................................................................................................
expected:  12582912
     got:  12582912

real    0m2.668s
user    0m2.360s
sys     0m0.540s
$ time ./node --use-legacy test/pummel/test-https-large-response.js 
build body...done
got request
response!
....................................................................................................................................................................................................................................................................................................................
expected:  12582912
     got:  12582912

real    0m2.773s
user    0m2.330s
sys     0m0.720s

It seems to be no effect in legacy.

koichik commented 13 years ago

This has fixed by 4cdf9d4.

Node v0.5.9 (legacy backend):

$ time node --use-legacy test/pummel/test-https-large-response.js 
build body...done
got request
response!
....................................................................................................................................................................................................................................................................................................................
expected:  12582912
     got:  12582912

real    0m1.967s
user    0m1.230s
sys 0m0.980s

Node v0.5.9 (libuv backend):

$ time node test/pummel/test-https-large-response.js
build body...done
got request
response!
..................................................................................................................................................................................................
expected:  12582912
     got:  12582912

real    0m9.516s
user    0m9.880s
sys 0m0.730s

current master (528c285):

$ time ./node test/pummel/test-https-large-response.js 
build body...done
got request
response!
.................................................................................................................................................................................................
expected:  12582912
     got:  12582912

real    0m1.928s
user    0m1.830s
sys 0m0.270s