Working with Rails for some time you start nitpicking on how to improve it. This is a first in the series of articles regarding on how to improve (even marginally) Rails's performance. I'll focus on a bunch of gems that speed up, in some cases considerably, small parts of Rails, like the html escaping, the String#blank? ...
Improve Rails performance by adding a few gems
Is Rubinius 2.2.3 production ready ?
Ruby 2.1 was released this Christmas, great news everyone! It sports a better GC (RGenGC - gerational GC), hierarchical method caching, some small syntax changes and non-experimental rafinements. All in all one can expect 5% to 15% performance increase which is quite awesome. As I was reading the comments in the hacker ...
Installing a rails mysql stack on my laptop was a bit tricky
I’ll keep this short: firstly I’ve downloaded the ruby windows installer from here , at the time of writing the version was _1.9.2-p0. _The problem with this one is that ruby crashes into oblivion from time to time (mostly after lots of page refreshes); after a googler search I’ve found out it’s a windows bug (yeah on ...
Building a small blog cms in rails
Yes, building a blog cms in rails is apparently very simple, well to be true it’s simple if you want something really limited like a post model, a couple of static pages, controllers and one for the contact form and you’re settled. Actually for something like this one can use Sinatra (not to say that Sinatra is better ...
Chunked transfer encoding in Rails (streaming)
Anyone that has written a little PHP knows what the flush() family of functions do. The ideal usage scenario for using chunked transfer[0] is when we have something costly to render e.g. the first three most recent articles on a blog. Why ? one might ask. Is rather simple: in a normal request where the server responds ...
Ruby 2.2.0 Preview 1 quick Rails benchmarks
Great news everyone! Ruby 2.2 preview 1 has been released ! I'm really curios about the Incremental GC and Symbol GC so let's run some quick Rails benchmarks on a normal Rails API app. First off let's install the preview via RVM: rvm install ruby-2.2.0-preview1 After fiddling around about five minutes trying to find a ...
Shedding some light into UUID version 4 in Ruby and Rails
Ruby's standard library and Rails's PostgreSQL adapter use by default version 4 UUIDs. This can be changed in Rails migrations via: default: 'uuid_generate_v1()' param whereas Ruby's stdlib only supports version 4. Another interesting difference is in the implementations: In the Ruby's stdlib the UUID method is found in ...
Making Rails asset pipeline faster
We all know that for a rather large Rails app where the front-end is quite stuffed, the asset pre-compilation and more importantly - development mode changes are far from instantaneous. The front-end we're referring to is the kind that makes heavy use of sass, sass libraries (Compass, Bourbon, etc.) and transpiled ...
Keep your Rails logs free of unwanted noise
I like to use Rollbar 's default plan for small apps or prototypes that are wip. Getting production exceptions in my inbox can be quite useful but most of them are actually 404s - sure there are a multitude of ways for filtering out the noise (Fail2Ban , hand written IPTables rules , etc.) The main idea here is to ...
Interesting links - Is logging a "code smell" ?
I was reading this article it raises quite an unexpected question - "Can we consider logging as a code smell"? Clearly - the answer is more nuanced than that and whilst I do enjoy the event bus approach from the article - that seems like overkill for most applications. It's interesting that Aspect Oriented Programming ...
Ruby meets LISP: Unveiling alien tech at Friendly.rb's lightning talk
Recently at the Friendly.rb conference in Romania, I explored an experimental blend of Ruby and LISP, particularly through Clojure. This journey was more about embracing the spirit of experimentation intrinsic to Ruby, rather than direct comparison. A big shoutout to Jakob , whose suggestion that I do a lightning talk ...
Kamal, Rails deployments, and Rega turntables
Lately I've started to put back into a working state my turntable. It's been disconnected from my main audio chain for about five years. The TT is a Rega RP3 with a bog-standard Rega Carbon cartridge. Why now one might ask? It wasn't my top priority and streaming Spotify to the WiiM Mini then via a DAC directly into my ...