Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

ZJIT removes redundant object loads and stores (https://railsatscale.com)

88 points by tekknolagi 4 days ago | 19 comments | View on ycombinator

mananaysiempre 1 day ago |

Of all the facets of HN’s title autodestroy, I think removing “How” from titles is the worst one. I believe OP can edit it back in though.

(I passed over this article thinking it was a “look how mysteriously smart the mysteriously smart compiler is” acticle, not a “here’s how the smarts in a compiler work” one.)

diablevv about 21 hours ago |

The escape analysis piece is what makes this particularly interesting. ZJIT can prove an object doesn't escape a method's scope and then eliminate the heap allocation entirely — the object lives on the stack (or in registers) and the load/store optimizations follow naturally once there's no indirection.

YJIT's profile-guided approach is powerful but pays a cost every time a hot path diverges from the expected type. The BBV approach in ZJIT bakes type assumptions directly into the compiled code, so you get the same specialization without the deopt overhead on the happy path. The tradeoff is code size — more type combinations means more compiled variants — but for server-side Rails apps where the method profile is fairly stable, that's usually fine.

Curious whether they're planning to share any of the escape analysis machinery upstream to YJIT, or if the JIT designs are diverging permanently.

smj-edison about 19 hours ago |

I'm working on an interpreter right now, and I'm considering adding JIT support in the future. Are there other blog posts like this, or deep dives that talk about how to implement and tune a JIT?

claudiug 1 day ago |

for me is more interesting that Maxime Chevalier-Boisvert left shopify and is doing other stuff, who will carry on with zjit

mchusma 1 day ago |

curious if zjit will be ready to be default over yjit next ruby release. hope so!

riteshyadav02 1 day ago |

[dead]