Project

General

Profile

Actions

Feature #3010

closed

slow require gems in ruby 1.9.1

Added by JiangMiao (Miao Jiang) about 15 years ago. Updated almost 14 years ago.

Status:
Closed
Target version:
[ruby-core:28954]

Description

=begin
ruby 1.9.1 version: ruby 1.9.1p420 (2010-02-04 revision 26571) [i686-linux]
ruby 1.8.7 version: ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]
ruby 1.9 takes a lot time on require 'gemname'

for code: foo.rb
puts $:.size
require 'rubygems'
require 'active_record'
puts $:.size

run: time foo.rb

in 1.9.1 it shows
106
110
real 0m0.905s
user 0m0.777s
sys 0m0.125s

in 1.8.7 it shows
9
21
real 0m0.263s
user 0m0.188s
sys 0m0.060s

And I check $: in code start and after load gem.
in 1.9.1 ruby load the whole rubygems directory on start.
in 1.8.7 ruby only load the nessceary directory for rubygems.
Maybe that is the reason.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0