-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
40a97f8
Ignore `/build*`.
ioquatix ec05790
Improve benchmarks and tests for threads.
ioquatix 0873e3a
Show thread and fiber limits as part of bootstrap tests.
ioquatix 800d1d4
Move vm stack init into thread.
ioquatix 8e94444
Fix handling of vm_stack_size and avoid trying to deallocate it.
ioquatix c80ce75
Better handling of root fiber.
ioquatix 888a50d
Ensure execution context is cleared after thread is finished.
ioquatix 09fb434
Track how stack was allocated for `cont_free`.
ioquatix 8a73a6f
Use stack size defaults for win32 threads.
ioquatix 4ef5660
Basic assertions for thread initialization.
ioquatix 395f09d
Handle (empty) backtrace when thread is not born yet.
ioquatix 698cca6
Use default stack size for worker thread (no th pointer available).
ioquatix 9e1bb9d
Make sure `alloca` fast path is used (inline assembler).
ioquatix 5be567f
Specify that size is non-committed memory.
ioquatix 52a6a6a
Update `stack_start` and `stack_maxsize` according to stack direction.
ioquatix 3642d0d
Use shared implementation of `rb_ec_initialize_vm_stack`.
ioquatix 9a2d9b6
Rework debug conditional.
ioquatix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ lcov*.info | |
/*.pc | ||
/*.rc | ||
/*_prelude.c | ||
/build* | ||
/COPYING.LIB | ||
/ChangeLog | ||
/Doxyfile | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
benchmark: | ||
ioquatix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
vm_thread_alive_check: | | ||
t = Thread.new{} | ||
while t.alive? | ||
Thread.pass | ||
end | ||
loop_count: 50_000 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# n.b. this is a good test for GVL when pinned to a single CPU | ||
|
||
1000.times{ | ||
5_000.times{ | ||
Thread.new{loop{Thread.pass}} | ||
} | ||
|
||
i = 0 | ||
while i<10000 | ||
while i<10_000 | ||
i += 1 | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require 'thread' | ||
|
||
n = 1_000_000 | ||
n = 10_000_000 | ||
q = Thread::Queue.new | ||
consumer = Thread.new{ | ||
while q.pop | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
benchmark: | ||
vm_thread_sleep: | | ||
Thread.new { sleep } | ||
loop_count: 10_000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.