Please somebody merge and benchmark the pull request at https://github.com/joyent/node/pull/3079
On Sunday, April 8, 2012 4:08:48 AM UTC+5:30, Jann Horn wrote: > > Hello, > I've been using a little ad-filtering proxy I built using node for some > time now, and today I had a look at its CPU usage while flash was > prefetching a very large youtube video. Well, it was relatively high, I > think, but the only thing it should be doing at that time is using > the .pipe() method to pipe from one HTTP stream to another one. > > Well, I was surprised to see that node was wasting ~2.5% of its CPU > usage on v8::String::New calls in node::MakeCallback, and that > node::MakeCallback in total has a CPU overhead that amounts to ~7% of > the total CPU time node uses in this case. Shouldn't it at least be > possible to cache the symbol string? And couldn't node maybe also avoid > calling v8::Object::Get each time it wants to call into userland (~3.6% > )? > > Are these things right or did I make some huge mistake? If they are > right, would it be possible to make this stuff a bit faster? Reducing > the CPU usage by 5% seems like a relatively big speed improvement to me. > > Node version: 0.6.14 > > Call graph centered on MakeCallback: > http://thejh.github.com/callgraph.png > > Raw callgrind output: > http://thejh.github.com/callgrind.out.19701 > > On Sunday, April 8, 2012 4:08:48 AM UTC+5:30, Jann Horn wrote: > > Hello, > I've been using a little ad-filtering proxy I built using node for some > time now, and today I had a look at its CPU usage while flash was > prefetching a very large youtube video. Well, it was relatively high, I > think, but the only thing it should be doing at that time is using > the .pipe() method to pipe from one HTTP stream to another one. > > Well, I was surprised to see that node was wasting ~2.5% of its CPU > usage on v8::String::New calls in node::MakeCallback, and that > node::MakeCallback in total has a CPU overhead that amounts to ~7% of > the total CPU time node uses in this case. Shouldn't it at least be > possible to cache the symbol string? And couldn't node maybe also avoid > calling v8::Object::Get each time it wants to call into userland (~3.6% > )? > > Are these things right or did I make some huge mistake? If they are > right, would it be possible to make this stuff a bit faster? Reducing > the CPU usage by 5% seems like a relatively big speed improvement to me. > > Node version: 0.6.14 > > Call graph centered on MakeCallback: > http://thejh.github.com/callgraph.png > > Raw callgrind output: > http://thejh.github.com/callgrind.out.19701 > > On Sunday, April 8, 2012 4:08:48 AM UTC+5:30, Jann Horn wrote: > > Hello, > I've been using a little ad-filtering proxy I built using node for some > time now, and today I had a look at its CPU usage while flash was > prefetching a very large youtube video. Well, it was relatively high, I > think, but the only thing it should be doing at that time is using > the .pipe() method to pipe from one HTTP stream to another one. > > Well, I was surprised to see that node was wasting ~2.5% of its CPU > usage on v8::String::New calls in node::MakeCallback, and that > node::MakeCallback in total has a CPU overhead that amounts to ~7% of > the total CPU time node uses in this case. Shouldn't it at least be > possible to cache the symbol string? And couldn't node maybe also avoid > calling v8::Object::Get each time it wants to call into userland (~3.6% > )? > > Are these things right or did I make some huge mistake? If they are > right, would it be possible to make this stuff a bit faster? Reducing > the CPU usage by 5% seems like a relatively big speed improvement to me. > > Node version: 0.6.14 > > Call graph centered on MakeCallback: > http://thejh.github.com/callgraph.png > > Raw callgrind output: > http://thejh.github.com/callgrind.out.19701 > >