https://railsatscale.com/2026-03-18-how-zjit-removes-redundant-object-loads-and-stores/ #RailsOptimization #TechNews #PerformanceImprovement #HackerNews #ngated
Ruby 4.0.2 ์ ์ ์ถ์ ๋ฐ YJIT ๋ฒ๊ทธ ์์ ์ ๋ฐ์ดํธ ์๋ด
Ruby 4.0.2๋ Puma ์๋ฒ ํ๊ฒฝ์์ ๋ฐ์ํ๋ YJIT ๊ด๋ จ NoMethodError ๋ฒ๊ทธ๋ฅผ ํด๊ฒฐํ์ฌ ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ตฌ๋ ์์ ์ฑ์ ๋ํญ ํฅ์์ํจ ์ ๊ธฐ ์ ๋ฐ์ดํธ ๋ฒ์ ์ ๋๋ค.
Ruby 4.0.2 ์ ์ ์ถ์ ๋ฐ YJIT ๋ฒ๊ทธ ์์ ์ ๋ฐ์ดํธ ์๋ด
Ruby 4.0.2๋ Puma ์๋ฒ ํ๊ฒฝ์์ ๋ฐ์ํ๋ YJIT ๊ด๋ จ NoMethodError ๋ฒ๊ทธ๋ฅผ ํด๊ฒฐํ์ฌ ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ตฌ๋ ์์ ์ฑ์ ๋ํญ ํฅ์์ํจ ์ ๊ธฐ ์ ๋ฐ์ดํธ ๋ฒ์ ์ ๋๋ค.
2026๋ ์ ๋ ์ผ์ฆ ์คํํธ์ : ๋๋ ค์์ ๋์ด ํ์ ์ผ๋ก ๋์๊ฐ๋ ๋ฃจ๋น ์ํ๊ณ
๋ฃจ๋น ์จ ๋ ์ผ์ฆ๋ ๋จ์ํ ์ ์ฐ์ด ์๋๋ผ Bold, Kora, Intercom Finn๊ณผ ๊ฐ์ ์ต์ AI ๊ธฐ๋ฐ ํ์ ์คํํธ์ ๋ค์ด ์ ํํ๋ ๊ฐ๋ ฅํ ์์ฐ์ฑ ๋๊ตฌ๋ก ์ ์ฆ๋์์ต๋๋ค.
#yjit
https://ruby-news.kr/articles/rubyconfth-2026-irina-nazarova-keynote-startups-on-rails-in-2026

๋ฃจ๋น ์จ ๋ ์ผ์ฆ๋ ๋จ์ํ ์ ์ฐ์ด ์๋๋ผ Bold, Kora, Intercom Finn๊ณผ ๊ฐ์ ์ต์ AI ๊ธฐ๋ฐ ํ์ ์คํํธ์ ๋ค์ด ์ ํํ๋ ๊ฐ๋ ฅํ ์์ฐ์ฑ ๋๊ตฌ๋ก ์ ์ฆ๋์์ต๋๋ค.
Ruby Game Boy ์๋ฎฌ๋ ์ดํฐ ์ ์๊ธฐ: AI์ ํจ๊ปํ 10๋ ๋ง์ ๋ถํ
๋ฐํ์ Colby Swandale์ 10๋ ์ ๊ฐ๋ฐ์ ์ค๋จํ๋ Ruby ๊ธฐ๋ฐ Game Boy ์๋ฎฌ๋ ์ดํฐ Waterfell์ ์ต์ AI ๋๊ตฌ์ธ Claude Code๋ฅผ ํ์ฉํด ์์ฑํ์ต๋๋ค.
Ruby 4.0์ ์๋ก์ด ์คํ์ ์ปดํ์ผ๋ฌ ZJIT์ YJIT์ ์ฑ๋ฅ ๋น๊ต ๋ฐ 2026๋ ์ด์ ๊ฐ์ด๋
Ruby 4.0์์ ๋์ ๋ ZJIT๋ ๋ฉ์๋ ๊ธฐ๋ฐ์ ์คํ์ JIT ์ปดํ์ผ๋ฌ๋ก, ๊ธฐ์กด ์ธํฐํ๋ฆฌํฐ๋ณด๋ค ๋น ๋ฅด์ง๋ง ํ์ฌ๋ YJIT์ ์ฑ๋ฅ์ ๋ฏธ์น์ง ๋ชปํ๋ ๋จ๊ณ์ ๋๋ค.
#yjit
https://ruby-news.kr/articles/ruby-4-0s-zjit-vs-yjit-benchmarks-safest-settings-and-what-to-try-in-2026-8dd32bf345f5
Ruby 4.0์ ZJIT: ๋๋ฆฌ์ง๋ง ํ์ํ ์ฅ๊ธฐ์ ์ํคํ ์ฒ ์ ํ
Ruby 4.0์ ๋์ ๋ ZJIT ์ปดํ์ผ๋ฌ๋ YJIT๋ณด๋ค ์ด๊ธฐ ์ฑ๋ฅ์ ๋๋ฆฌ์ง๋ง, ์ฅ๊ธฐ์ ์ธ ํ์ฅ์ฑ๊ณผ ์ปค๋ฎค๋ํฐ ๊ธฐ์ฌ๋ฅผ ์ํ "๊ต๊ณผ์์ " ์ํคํ ์ฒ๋ฅผ ์ฑํํ์ต๋๋ค.
#yjit
https://ruby-news.kr/articles/zjit-explained-why-ruby-4-0s-slower-jit-compiler-is-actually-a-genius-move-c04f3ef7aa0c
Ruby ์ฝ์ด ์ธ์ด ์ฃผ์ ๋ณ๊ฒฝ ๋ฐ ์ฑ๋ฅ ๊ฐ์ ์ฌํญ ์์ฝ
YJIT ํ์ฑํ ์ ๊ฐ์ฒด ํ ๋น ์ฑ๋ฅ์ด ์์น ์ธ์ ์ฝ 2.3๋ฐฐ, ํค์๋ ์ธ์ ์ฝ 6๋ฐฐ๋ก ๋ํญ ํฅ์๋์์ต๋๋ค.
Solved today's #adventofcode part 2 non-discretely. Took me four hours, maybe more. Memory requirements are minimal and my running time is slightly above two seconds (#Ruby with #YJIT).
The code is here: https://codeberg.org/der-scheme/adventofcode.rb/src/branch/main/2025/09
The repo also contains a visualization in case somebody needs it.
Approach in content warning below:
I went kinda nuts on yesterday's #adventofcode trying to optimize my #Ruby implementation. The resulting code is nothing special, but here it is, for reference: https://codeberg.org/der-scheme/adventofcode.rb/src/branch/main/2025/08
I consistently achieve sub 2.5 seconds with #YJIT for all four (both parts on both input and test input) runs, including I/O and all the process spawning stuff, measured by `time ./test`. No JIT is about 25โ30% slower. I have no idea how fast this is, but I'm stating it for transparency.
I consider myself a smooth-brain, but here's what I believe to have learned (some very obvious, others not so much):
- Even if you don't care about your return values (discarding them), YJIT does. So if the return value is irrelevant, return a predictable value; self is a good choice. This is consistent with YJIT's documented behavior.
- There's a tiny overhead in splatting, so it's faster to be explicit.
- There seems to be some overhead in the creation of local variables. Sometimes it's faster calling a reader method multiple times.
- While structs (Struct, not Data, although they share most of the implementation) can be slightly slower than trivial wrapper classes, I found a case where a struct with a single field resulted in a 15% overall runtime boost compared to the equivalent class. It's no longer in the code base, though, because:
- Oftentimes, shoving everything into an array to deal with later is faster than dealing with it early.
- There seems to be no performance gain in freezing. I attempted freezing an object in the constructor hoping YJIT would maybe inline instance variable access, but this resulted in an overall 10% performance drop through this single line change. However, the necessary code changes resulted in speedups in other places, so the work was still worth it.
- Sometimes arrays are faster, sometimes enumerators are faster, for the exact same functionality.
- `def some_size = some&.size || 0` seems faster than the verbose alternative. Maybe YJIT can optimize operators better than branches?
- There's a bunch of stuff I didn't try, like the C-like implementations you can find published all over the internet. If I wanted to write fast but unreadable code, I'd use FFI and C.
- Git commit makes your code run slower. I assume there's some FS weirdness going on which is triggered by committing, like maybe a cache reset.