Project

General

Profile

Feature #3010

slow require gems in ruby 1.9.1

Added by JiangMiao (Miao Jiang) over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
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


Related issues

Related to Backport187 - Backport #2723: $: length affects re-require time of already loaded filesRejectedknu (Akinori MUSHA)Actions

Also available in: Atom PDF