Skip to content

Run MJIT worker on Ractor #4024

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 1 commit into from
Closed

Run MJIT worker on Ractor #4024

wants to merge 1 commit into from

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jan 5, 2021

so that we can gradually rewrite its C implementations to Ruby for better maintainability.

@k0kubun k0kubun marked this pull request as draft January 5, 2021 08:05
@k0kubun
Copy link
Member Author

k0kubun commented Jun 15, 2022

I compared Ractor-based MJIT worker (this pull request), pthread-based MJIT worker (master before #6006), and SIGCHLD-based MJIT (#6006). Using Ractor was the slowest option even though this patch doesn't really use Ruby on Ractor.

$ benchmark-driver benchmark.yml --rbenv 'Ractor::ruby --mjit;pthread::before --mjit;SIGCHLD::after --mjit' -v --repeat-count=12 --output=all --alternate
Ractor: ruby 3.2.0dev (2022-06-11T04:35:36Z mjit-ractor 715a56cf62) +MJIT [x86_64-linux]
pthread: ruby 3.2.0dev (2022-06-15T05:42:09Z master 46706e7808) +MJIT [x86_64-linux]
SIGCHLD: ruby 3.2.0dev (2022-06-15T07:21:31Z no-mjit-worker 90433da34d) +MJIT [x86_64-linux]
Calculating -------------------------------------
                                       Ractor               pthread               SIGCHLD
Optcarrot Lan_Master.nes   122.11488821088365    125.19591944247455    129.05306752406173 fps
                           122.85940690249019    126.97394577904440    131.17823047699284
                           123.03217049280930    127.43213612258764    131.30718564707067
                           123.12385073297108    127.83948179226464    131.31601009593803
                           123.89892914559128    128.03931000297257    131.32606980490471
                           123.95205936483329    128.13188130488584    132.22289995420718
                           124.39441344150995    128.53326337315968    132.77223197963457
                           125.10127121680009    128.60935730780119    133.62675591296690
                           125.45436434365493    128.77971320075770    133.85093987570733
                           126.68123059796693    130.19945746782713    134.41523057182860
                           127.01608575503327    131.07072255845716    134.88855440196266
                           127.30496963460307    131.08087072184196    135.10506310081215

@k0kubun k0kubun closed this Jun 15, 2022
@eregon
Copy link
Member

eregon commented Aug 20, 2022

Using Ractor in CRuby starts synchronization in multiple places (RB_VM_LOCK_ENTER/RB_VM_LOCK_LEAVE) so I'm not surprised it's slowing down the main thread.

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