The RailsNotes Newsletter

🟥 ISSUE #1 (Procfile.dev, Jemalloc, YJIT and dockerfile-rails)

“ruby gemstones in little minecarts on a cartoon robotic production line, 3d 32-bit isometric illustration, style of studio ghibli, soft warm lighting“

Welcome to The RailsNotes Newsletter — Issue #1!

Thank you to all 37 of you for subscribing! 🥳

The format I’m aiming for in these newsletters is a featured article from RailsNotes, a couple of interesting Rails articles from around the web, and a handy Rails tip or trick.

I hope you enjoy reading this newsletter! Like my blog, I’m trying to keep this newsletter focused, informative and to the point. And a bit of fun 🕺😅. If you enjoy reading this or have some feedback, reach out! You can reply to this email to get in touch.

Thanks, Harrison.

Featured Article —

A rubbish bin writing Ruby on Rails code — a “bin dev” 😎

I published this article this week, with great reception from people on Reddit and Hacker News.

Since discovering bin/dev and Procfile.dev, I've used them extensively in my own Ruby on Rails projects.

In this article, I share what these files are, how they work, and some tips and tricks to improve your local dev environment (like adding Redis and Sidekiq to your Procfile.dev)

More articles from around the web

  • Malloc Can Double Multi-threaded Ruby Program Memory UsageDo you love free performance improvements? I sure do, and in this article, Nate Berkopec from the excellent speedshop.io explains how memory allocation affects Ruby on Rails apps and Sidekiq workers, and how switching to jemalloc (instead of malloc) for memory allocation can drastically cut the memory usage of our Rails apps.

  •  Ruby 3.2’s YJIT is Production-ReadyContinuing with the performance theme — more free performance gains! In January this year, Shopify announced that YJIT, Ruby’s new compiler, was production ready. It’s now used internally at Shopify, with speedups of 10-30% across the board.

  • [GEM] dockerfile-rails — An excellent gem from fly.io (and likely to make it into Rails 7.1). dockerfile-rails can automatically generate a Dockerfile for your Ruby on Rails app, and lets you easily include jemalloc and YJIT (from the two previous links).

A handy tip — previous result in the Rails console

Did you know the rails console automatically stores the result of your previous command? You can access it using the _ (underscore) character.

Here’s a super basic example —

irb(main):001:0> 2+2
=> 4
irb(main):002:0> _        # get previous result
=> 4
irb(main):003:0> _ + 2    # use previous result
=> 6

This should work for everything though — give it a try!