Sunday, May 15, 2011

The lines that save us days of work (Rails patch)

We do program Ruby On Rails over Windows OMG!.
Thanks to the RubyInstaller  project [*] the daily tasks run as smooth as if we were in a *nix based O.S.
There is however one thing that still make working over windows inferior than doing the same over linux: the full stack took longer to load. So, if you run tests too often you end up wasting a no little time at the end of the day.
There are a couple of things that you can do to cut the load time:
  1. Latests versions of Ruby (Ruby Gems) load faster than old ones.
  2. If you run an antivirus, exclude Ruby directory from analysis
  3. The king:
It seems that the problem is in the Kernel::require method, that is unoptimized in windows. Fortunately you can patch it to increase the speed. Or more accurately, skip duplicated require invokations. Just add these lines at the beginning of your config/environment.rb .

unless ENV['RAILS_ENV'] == 'production'#Rails.env.production?
    module Kernel
      alias chained_require require
      def require(path)
        $SPEEDUP_LIBCACHE[path] ||= chained_require path
      private :require
      private :chained_require

Thats all. BTW: I found no difference in linux: it already loads quickly.

[*] Remember installing DevKit ( ) to automatically build gems with native extensions.

Monday, May 2, 2011

Para los que pasan muchas horas delante del ordenador: F.lux

F.lux es un sencillo programa que cambia el esquema de color de tu ordenador dependiendo de la hora del día. Llevo utilizándolo aproximadamente un mes y la verdad es que los ojos te lo agradecen.

Está disponible gratuitamente en para las 3 plataformas más extendidas (Win, Mac y Linux).
Software bueno, bonito, barato y UTIL.