Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Optimize debug() calls for performance boost #13

Open
pingdom-christian opened this issue Sep 23, 2011 · 1 comment
Open

Optimize debug() calls for performance boost #13

pingdom-christian opened this issue Sep 23, 2011 · 1 comment

Comments

@pingdom-christian
Copy link

There are a few debug() calls in websocket.js that really slowed down our application. We have a high throughput of packets, and it turns out that sys.inspect() consumed almost 90% of the CPU time, which could be pinpointed down to these debug() calls.

Example:

debug('dataListener(' + sys.inspect(buf) + ')');

When we commented out these (for us) unnecessary calls, performance was substantially increased. I suppose you could create something like debugBuffer() and send buf as the argument. Inside the function you would then check the debug level before calling sys.inspect().

bwillard added a commit to bwillard/node-websocket-client that referenced this issue Oct 6, 2011
@davidfooks
Copy link

+1

this single change just sped up my node server by a factor of 10!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants