title: Installed gem much slower than source
body: <p>Running an installed gem is much slower than running its local source counterpart.</p>
  
  <p>Installed gem:</p>
  
  <pre><code>$ time wmctile switch_to Thunderbird
  
  real  0m0.682s
  user  0m0.491s
  sys 0m0.091s
  </code></pre>
  
  <p>Local source:</p>
  
  <pre><code>$ time ./work/wmctile/bin/wmctile switch_to Thunderbird
  
  real  0m0.197s
  user  0m0.118s
  sys 0m0.064s
  </code></pre>
  
  <p>Why? Could it be because of RVM, or is this a "feature" of Ruby gems in general? Is there a way to speed it up?</p>
  
  <p>This is the generated bin file:</p>
  
  <pre><code>$ which wmctile
  /home/some_user_name/.rvm/gems/ruby-2.1.2/bin/wmctile
  
  $ cat $( which wmctile )
  #!/usr/bin/env ruby_executable_hooks
  #
  # This file was generated by RubyGems.
  #
  # The application 'wmctile' is installed as part of a gem, and
  # this file is here to facilitate running it.
  #
  
  require 'rubygems'
  
  version = "&gt;= 0"
  
  if ARGV.first
    str = ARGV.first
    str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
    if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
      version = $1
      ARGV.shift
    end
  end
  
  gem 'wmctile', version
  load Gem.bin_path('wmctile', 'wmctile', version)
  </code></pre>