Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Detecting current stack depth
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Will Conant  
View profile  
 More options Jul 15 2011, 5:58 pm
From: Will Conant <will.con...@gmail.com>
Date: Fri, 15 Jul 2011 14:58:56 -0700 (PDT)
Local: Fri, Jul 15 2011 5:58 pm
Subject: Detecting current stack depth
Is it possible to detect the current stack depth?

I have a case where a function with an asynchronous interface is far
more likely to complete synchronously than to actually do anything
asynchronous. In an earlier post (linked below) it looks like Ryan
suggests using process.nextTick to make the behavior of such functions
consistent, but that can make things really slow. In fact, from my
testing of the simplest case function that uses process.nextTick vs.
one that just immediately calls its callback, process.nextTick takes
more than 10x as long (which isn't really surprising).

Here is the earlier discussion on the topic:

http://groups.google.com/group/nodejs/browse_thread/thread/6fd56eb6cc...

What I'd really like to do is detect the stack depth and only use
process.nextTick when I'm past a certain threshold. This way, I can
have a really speedy implementation that still won't ever max out the
stack.

Is that possible? Is that horrible?

Thanks in advance!

--
Will Conant


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.