Project

General

Profile

Actions

Bug #3924

closed

Performance bug (in require?)

Added by cabo (Carsten Bormann) about 14 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:32736]

Description

=begin
Running irb < /dev/null in 1.9.2 causes 3016 calls to lstat64.

For instance, there is a sequence of 28 repetitions each of lstat calls to all 6 non-empty path prefixes of /opt/local/lib/ruby1.9/1.9.1/irb.rb -- a total of 170 lstats apparently just to load this file; another set of lstats then occurs later for another 18 (times 6) times. Clearly, something is running amok in the calling sequence rb_require_safe -> realpath_rec -> lstat.

Another example: Running a simple test with the baretest gem causes 17008 calls to lstat. According to perftools.rb, 80 % of the 1.2 seconds of CPU is used in Kernel#gem_original_require (and another 12 in GC, some of which may be caused by this).
=end


Files

dt1 (285 KB) dt1 dtruss file with 3016 calls to lstat64 (irb </dev/null) cabo (Carsten Bormann), 10/10/2010 08:15 AM
require_performance.diff (28.6 KB) require_performance.diff xaviershay (Xavier Shay), 05/23/2011 07:56 PM

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #7158: require is slow in its bookkeeping; can make Rails startup 2.2x fasterClosedh.shirosaki (Hiroshi Shirosaki)10/14/2012Actions
Is duplicate of Ruby master - Feature #3906: Initializing and loading Rails environment takes really long on Windows XPClosednahi (Hiroshi Nakamura)10/05/2010Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0