-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Use alloca
to improve performance of thread creation.
#2227
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
Conversation
@ko1 here is a rough idea of performance characteristics:
|
I want to investigate more the cases where it's slower. |
I just realised since we are using C99 we can use variable length array instead of |
Actually, I think that while we have switched to C99, there are still a few off-limit features, and variable length arrays was one of them. I seem to remember the reason was VisualStudio, but not completely sure. |
I've had to add a variable to track whether or not to free the stack. But in combination with the other PR for fiber pool, this can be removed. |
Why did it happen, it seems like vm stack has corruption or is not set up correctly. |
Okay, back to |
I didn't realise this but
@ko1 what do you think? Creating threads (e.g. |
@duerst I tried VLA and found performance was better. So I checked man page of |
alloca
to improve performance of thread creation.
@tenderlove if you have time I'd love your feedback on this, even if just briefly. If you are busy, don't worry about it :) From your most recent work, I think we have some interests in common. |
Okay, it's merged. |
This avoids the need for
vm_stack
allocation per thread, which improves performance and can lead to code simplification (removal of stack recycling code).