Skip to content

Use native thread locals. #3665

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
wants to merge 3 commits into from

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Oct 18, 2020

By using native thread locals, we can regain most of the lost performance. compare-ruby is one commit before ractor was merged. built-ruby is this PR on master. master was around 7.5m on my computer.

|                 |compare-ruby|built-ruby|
|:----------------|-----------:|---------:|
|vm_fiber_switch  |     11.608M|   10.431M|
|                 |       1.11x|         -|

However, I experienced some segfault, but I don't know why yet. The implementation is not changed. Maybe there is race condition.

@ioquatix ioquatix force-pushed the use-native-thread-local branch from c77dcc7 to c9a6f44 Compare October 18, 2020 05:09
@ioquatix
Copy link
Member Author

@ko1 it seems segfault with mjit. Do you have any idea why? No function is changed.

@ioquatix ioquatix force-pushed the use-native-thread-local branch 3 times, most recently from 6d3716b to 22f32f5 Compare October 19, 2020 04:30
@ioquatix ioquatix force-pushed the use-native-thread-local branch from 22f32f5 to 7596105 Compare October 19, 2020 05:11
ko1 added a commit to ko1/ruby that referenced this pull request Oct 19, 2020
To access TLS, it is faster to use language TLS specifier instead
of using pthread_get/setspecific functions.

Original proposal is: Use native thread locals. ruby#3665
ko1 added a commit to ko1/ruby that referenced this pull request Oct 19, 2020
To access TLS, it is faster to use language TLS specifier instead
of using pthread_get/setspecific functions.

Original proposal is: Use native thread locals. ruby#3665
@ioquatix
Copy link
Member Author

Closing in favour of @ko1 PR.

@ioquatix ioquatix closed this Oct 19, 2020
ko1 added a commit to ko1/ruby that referenced this pull request Oct 19, 2020
To access TLS, it is faster to use language TLS specifier instead
of using pthread_get/setspecific functions.

Original proposal is: Use native thread locals. ruby#3665
ko1 added a commit to ko1/ruby that referenced this pull request Oct 19, 2020
To access TLS, it is faster to use language TLS specifier instead
of using pthread_get/setspecific functions.

Original proposal is: Use native thread locals. ruby#3665
ko1 added a commit that referenced this pull request Oct 19, 2020
To access TLS, it is faster to use language TLS specifier instead
of using pthread_get/setspecific functions.

Original proposal is: Use native thread locals. #3665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants