-
-
Save defunkt/284823 to your computer and use it in GitHub Desktop.
| # No RubyGems | |
| $ time hub version | |
| git version 1.6.0 | |
| hub version 0.2.0 | |
| real 0m0.047s | |
| user 0m0.015s | |
| sys 0m0.028s | |
| # With RubyGems | |
| $ time hub version | |
| git version 1.6.0 | |
| hub version 0.2.0 | |
| real 0m0.438s | |
| user 0m0.352s | |
| sys 0m0.089s | |
| # If you have the current git branch in your bash prompt, | |
| # you're going to notice the extra half second before it | |
| # renders. |
$ time hub version
git version 1.7.7.2
hub version 1.7.0
real 0m0.085s
user 0m0.060s
sys 0m0.016s
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ which hub
/home/chastell/.rvm/gems/ruby-1.9.3-p0@global/bin/hub
@chastell How did reduce the startup time? can you show us your output of cat $(type -P hub)
$ cat $(type -P hub)
#!/home/chastell/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'hub' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'hub', version
load Gem.bin_path('hub', 'hub', version)
Note that I have only 14 gems in my global gemset, so the require 'rubygems' call is cheap. Also note that it’s Ruby 1.9.3, which much faster require handling in general.
@chastell Thanks for the info, I didn't know the number of gems slowed down the load time, good to know that ruby 1.9.3 has some fixes.
it's still slow.
# No Rubygems
$ time hub version
> 0.03s user 0.01s system 49% cpu 0.093 total
# With Rubygems
$ time hub version
> 0.21s user 0.01s system 95% cpu 0.229 total
$ ruby --version
> ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ gem --version
> 1.8.11
$ gem list | wc -l
> 356
tested in ArchLinux with SSD.
Personal Conclusion
Standalone version 3 times faster than rubygems equivalent.
Environment
sisop ubuntu 12.04 in a virtual machine
ruby version 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
gem version 2.0.2
git version 1.7.9.5
hub version 1.10.5
Tests
# No Rubygems
time hub version
#=> real 0m0.096s user 0m0.060s sys 0m0.016s
# With Rubygems
time hub version
#=> real 0m0.266s user 0m0.208s sys 0m0.008sGogdghjpgg
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
This patch on the RubyGems issue tracker tries to speed things up:
http://rubyforge.org/tracker/index.php?func=detail&aid=28050&group_id=126&atid=577