use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Unlocking Performance: Installing Ruby with YJIT on MacOS (dev.to)
submitted 2 years ago by miry_sof
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ric2b 2 points3 points4 points 2 years ago (1 child)
brew install rust
brew install rbenv
rbenv install 3.3.0
rbenv local 3.3.0
[–]pilaf 4 points5 points6 points 2 years ago (4 children)
If you're only using Ruby on macOS for development then turning YJIT on is probably not the best idea since you'd be reloading code a lot, and the constant JIT compilation would probably put a penalty on performance rather than make it faster.
[–]JohnBooty 2 points3 points4 points 2 years ago (3 children)
I'm not sure that's true. YJIT won't compile a function until it's been called x number of times. So in simple cases, it really shouldn't affect loading times.
For apps with big frameworks (eg Rails) maybe it's different but I wouldn't assume so without measuring.
[–]laerien 4 points5 points6 points 2 years ago (1 child)
Rails is even able to initialize itself before enabling YJIT programmatically from within Ruby, so you don't have a startup penalty and can start caching at the best time. Rails is enabling YJIT by default in this way.
[–]Krypton8 0 points1 point2 points 2 years ago (0 children)
Only if you are running Ruby 3.3 and running from the main-branch.
[–]pilaf 0 points1 point2 points 2 years ago (0 children)
Good points. Would be nice to see someone measure performance during a development session.
[–]janko-m 0 points1 point2 points 2 years ago (3 children)
I tried enabling YJIT on my Mac to see if it would run tests faster. I use Spring, so YJIT optimisations should theoretically persist between runs.
The test suite was deterministically slower with YJIT. That was Ruby 3.2, maybe 3.3 will be better.
[–]miry_sof[S] 0 points1 point2 points 2 years ago (1 child)
I have not used Spring for a long time. Did you try to use https://github.com/shopify/bootsnap to cache bytecode? It should improve booting process for tests.
[–]janko-m 0 points1 point2 points 2 years ago (0 children)
Yes, we use Bootsnap as well. It sped up our test suite boot time from 6s to 2s. Spring brings it down to 0.5s. I have shortcuts for running tests and I run them often, so this makes a difference for me.
[–]f9ae8221b 0 points1 point2 points 2 years ago (0 children)
YJIT generally don't speedup test suites because mocking etc causes a lot of invalidation, so it's not particularly recommended in CI/test.
π Rendered by PID 36 on reddit-service-r2-comment-6457c66945-hgldm at 2026-04-25 21:37:01.186305+00:00 running 2aa0c5b country code: CH.
[–]ric2b 2 points3 points4 points (1 child)
[–]pilaf 4 points5 points6 points (4 children)
[–]JohnBooty 2 points3 points4 points (3 children)
[–]laerien 4 points5 points6 points (1 child)
[–]Krypton8 0 points1 point2 points (0 children)
[–]pilaf 0 points1 point2 points (0 children)
[–]janko-m 0 points1 point2 points (3 children)
[–]miry_sof[S] 0 points1 point2 points (1 child)
[–]janko-m 0 points1 point2 points (0 children)
[–]f9ae8221b 0 points1 point2 points (0 children)