-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slow in browser ? #135
Comments
yeah i found that as well today testing some things out. what takes 2s in the browser takes 7ms with node. seems odd i'll have to look into it, im sure i can adjust the dom stuff |
interesting, even commenting out the dom stuff it's still kinda slow, i did a profile as well and saw nothing useful, shaved maybe 20ms off of a 2s run from removing the dom stuff |
Ok - so it seems the problem is the process.nextTick using the setTimeout, which is slow. Swapping it out for setZeroTimeout (http://dbaron.org/log/20100309-faster-timeouts) made 5 times quicker (but still much slower than node). |
and replacing process.nextTick with process.nextTick = function(fn){ fn() }; reduced the time back down to 3ms. (though I'm sure this will mess with async tests!) |
or is it there more to do with stack traces ? |
we could remove those all together for the client-side, it's just nice to shorten the stack trace |
haha wow yeah that does it.. jesus.. forgot that thing is so slow |
hmmmm - I'm finding that having such a long stack is a _major_ slowness if you start trying to debug ... going to look into suggested setImmediate functions. |
well only the small portion would really be relevant, but yeah it does produce some ugly output |
I just tried it out (copy and paste from --- works a charm in Chrome at least. It's basically unusable without this On Mon, Dec 12, 2011 at 6:41 PM, TJ Holowaychuk <
|
scratch that - it's actually slow than the setZeroTimeout solution, On Mon, Dec 12, 2011 at 6:51 PM, Jonah Fox jonahfox@gmail.com wrote:
|
So from my experiments I've found that setZeroTimeout ( |
I've got the same tests running in both the browser and in node. In node they take 3ms, and in Chrome they take 700ms. All tests are synchronous and are handling some very basic logic. The Chrome profiler seems to just report that 90% of the time is spend in the "Program" so that's not much user. At first I thought it might be due to some kind of timer - but I can't see that in the codebase. Any ideas ?
The text was updated successfully, but these errors were encountered: