[#51792] [ruby-trunk - Bug #7768][Open] Inherited Array class missing — "england (Roman Ivanilov)" <englandpost@...>

14 messages 2013/02/01

[#51834] [ruby-trunk - Bug #7780][Open] Marshal & YAML should deserialize only basic types by default. — "marcandre (Marc-Andre Lafortune)" <ruby-core@...>

19 messages 2013/02/04

[#51897] [ruby-trunk - Feature #7791][Open] Let symbols be garbage collected — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

64 messages 2013/02/06
[#51899] [ruby-trunk - Feature #7791][Feedback] Let symbols be garbage collected — "shyouhei (Shyouhei Urabe)" <shyouhei@...> 2013/02/06

[#51909] Re: [ruby-trunk - Feature #7791][Feedback] Let symbols be garbage collected — SASADA Koichi <ko1@...> 2013/02/06

(2013/02/06 22:50), shyouhei (Shyouhei Urabe) wrote:

[#51898] [ruby-trunk - Feature #7792][Open] Make symbols and strings the same thing — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

86 messages 2013/02/06
[#51914] [ruby-trunk - Feature #7792] Make symbols and strings the same thing — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...> 2013/02/06

[#51916] Re: [ruby-trunk - Feature #7792] Make symbols and strings the same thing — Yorick Peterse <yorickpeterse@...> 2013/02/06

You don't need to hijack any code for it, you'd just use it as

[#51933] [ruby-trunk - Feature #7793][Open] New methods on Hash — "dsisnero (Dominic Sisneros)" <dsisnero@...>

20 messages 2013/02/06

[#51965] [ruby-trunk - Feature #7795][Open] Symbol.defined? and/or to_existing_symbol — "Student (Nathan Zook)" <blogger@...>

13 messages 2013/02/07

[#51977] [ruby-trunk - Feature #7797][Open] Hash should be renamed to StrictHash and a new Hash should be created to behave like AS HashWithIndifferentAccess — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

22 messages 2013/02/07

[#52042] [ruby-trunk - Bug #7805][Open] ruby 2.0rc2 core on solaris — "groenveld@... (John Groenveld)" <groenveld@...>

23 messages 2013/02/08

[#52049] [ruby-trunk - Bug #7807][Open] [PATCH] Remove duplicated load paths when empty version string is configured — "vo.x (Vit Ondruch)" <v.ondruch@...>

9 messages 2013/02/08

[#52075] [ruby-trunk - Feature #7816][Open] Don't invalidate method caches when defining a new method on a class without subclasses — "charliesome (Charlie Somerville)" <charlie@...>

17 messages 2013/02/09

[#52077] [ruby-trunk - Bug #7817][Open] (Unable to compile Ruby 2.0.0-rc2 on OSX (clang version 2.1) — "injekt (Lee Jarvis)" <ljjarvis@...>

10 messages 2013/02/09

[#52087] [ruby-trunk - Bug #7820][Assigned] Let's decide Ruby 2.0 supported platform list — "mame (Yusuke Endoh)" <mame@...>

15 messages 2013/02/10

[#52130] [ruby-trunk - Bug #7829][Open] Rounding error in Ruby Time — "loirotte (Philippe Dosch)" <loirotte@...>

25 messages 2013/02/11
[#52579] [ruby-trunk - Bug #7829] Rounding error in Ruby Time — "loirotte (Philippe Dosch)" <loirotte@...> 2013/02/20

[#52586] Re: [ruby-trunk - Bug #7829] Rounding error in Ruby Time — David MacMahon <davidm@...> 2013/02/20

[#52131] [ruby-trunk - Bug #7830][Open] Ruby packages should not build with -Werror when distributed — "kremenek (Ted Kremenek)" <kremenek@...>

21 messages 2013/02/11

[#52134] [ruby-trunk - Bug #7831][Open] Net::HTTP does not allow users to handle Content-Encoding in responses like 1.x — "drbrain (Eric Hodel)" <drbrain@...7.net>

10 messages 2013/02/11

[#52160] [ruby-trunk - Feature #7836][Open] Need a way to get Method and UnboundMethod objects to methods overridden by prepended modules — "banister (john mair)" <jrmair@...>

12 messages 2013/02/12

[#52165] [ruby-trunk - Feature #7839][Open] Symbol.freeze_symbols — "tenderlovemaking (Aaron Patterson)" <aaron@...>

23 messages 2013/02/12

[#52206] [ruby-trunk - Bug #7842][Assigned] An alias of a "prepend"ed method skips the original method when calling super — "mame (Yusuke Endoh)" <mame@...>

15 messages 2013/02/13

[#52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) — "timothyg56 (Timothy Garnett)" <timothyg@...>

18 messages 2013/02/13

[#52267] [ruby-trunk - Feature #7854][Open] New method Symbol[string] — "Student (Nathan Zook)" <blogger@...>

22 messages 2013/02/14

[#52296] [ruby-trunk - Bug #7860][Open] Passing --libdir to ./configure causes Gem.ruby to point to an incorrect ruby interpreter path — "cwgem (Chris White)" <cwprogram@...>

11 messages 2013/02/15

[#52395] [ruby-trunk - Bug #7874][Open] multiarch support enhancements — "terceiro (Antonio Terceiro)" <terceiro@...>

16 messages 2013/02/17

[#52513] [ruby-trunk - Feature #7882][Open] Allow rescue/else/ensure in do..end — "charliesome (Charlie Somerville)" <charlie@...>

11 messages 2013/02/19

[#52514] [ruby-trunk - Feature #7883][Open] Add Regex#to_proc — "rklemme (Robert Klemme)" <shortcutter@...>

15 messages 2013/02/19

[#52537] [ruby-trunk - Bug #7886][Open] Not recognizing unix group permissions for Mac OS X (Mountain Lion) Active Directory (AD) mobile accounts — "afazio (Alfred Fazio)" <alfred.fazio@...>

12 messages 2013/02/19

[#52596] [CommonRuby - Feature #7895][Open] Exception#backtrace_locations to go with Thread#backtrace_locations and Kernel#caller_locations — "headius (Charles Nutter)" <headius@...>

18 messages 2013/02/20

[#52614] [ruby-trunk - Bug #7897][Open] rubygems 2.0 has an incompatibility about installation of extension libraries if gem package does not contain lib directory — "mrkn (Kenta Murata)" <muraken@...>

8 messages 2013/02/21

[#52727] [ruby-trunk - Feature #7918][Open] Create Signal.in_trap?() — "kosaki (Motohiro KOSAKI)" <kosaki.motohiro@...>

10 messages 2013/02/23

[#52742] [ruby-trunk - Bug #7921][Assigned] Cross-compiling ruby_2_0_0 to Windows is failing (rb_w32_pow) — "luislavena (Luis Lavena)" <luislavena@...>

19 messages 2013/02/23

[#52875] [ruby-trunk - Bug #7956][Open] Install fail with RVM — Sega100500 (Сергей Е) <Sergey.V.Ezhov@...>

14 messages 2013/02/25

[#52877] Any documentation about debugging in Ruby 2.0.0 — Rodrigo Rosenfeld Rosas <rr.rosas@...>

Hi, I couldn't find how to debug Ruby 2.0.0 programs, but only a few

14 messages 2013/02/25
[#52880] Re: Any documentation about debugging in Ruby 2.0.0 — Jeremy Kemper <jeremy@...> 2013/02/25

On Monday, February 25, 2013, Rodrigo Rosenfeld Rosas wrote:

[#52883] Re: Any documentation about debugging in Ruby 2.0.0 — Rodrigo Rosenfeld Rosas <rr.rosas@...> 2013/02/25

Em 25-02-2013 10:47, Jeremy Kemper escreveu:

[#52886] Re: Any documentation about debugging in Ruby 2.0.0 — SASADA Koichi <ko1@...> 2013/02/25

(2013/02/26 0:22), Rodrigo Rosenfeld Rosas wrote:

[#52890] [ruby-trunk - Bug #7958][Open] include FileUtils::Verbose gives NoMethodError when installing files with a different mode — "drbrain (Eric Hodel)" <drbrain@...7.net>

12 messages 2013/02/25

[#52893] [ruby-trunk - Bug #7959][Open] configure contains non-portable shell code — "jeremyevans0 (Jeremy Evans)" <merch-redmine@...>

12 messages 2013/02/25

[#52936] [ruby-trunk - Bug #7968][Open] Poor UDPSocket#send performance in ruby 2.0.0 on windows — "cs96and (Alan Davies)" <alan.n.davies@...>

10 messages 2013/02/26

[#52997] [ruby-trunk - Feature #7978][Open] boolean to_i — "alexeymuranov (Alexey Muranov)" <redmine@...>

14 messages 2013/02/27

[#53017] [ruby-trunk - Bug #7982][Open] rb_raise segfaults on %lli format with (0xffffffff + 1) — "erik.s.chang (Erik Chang)" <erik.s.chang@...>

10 messages 2013/02/28

[#53025] [Backport 200 - Backport #7984][Open] Severe speed issues in 2.0.0 compiled with Clang — "jcole1989 (James Coleman)" <jtc331@...>

13 messages 2013/02/28

[ruby-core:51828] [ruby-trunk - Bug #7158] require is slow in its bookkeeping; can make Rails startup 2.2x faster

From: "lzap (Lukas Zapletal)" <lukas-x@...>
Date: 2013-02-03 19:32:11 UTC
List: ruby-core #51828
Issue #7158 has been updated by lzap (Lukas Zapletal).


Ok the above looks like bug in lib/irb/locale.rb:

LC_ALL=C strace irb < /dev/null 2>&1 | grep ENOENT | wc -l
293

It not only triples amount of stat/open calls, it is like 17.5x faster. I am filling new bugreport for this.
----------------------------------------
Bug #7158: require is slow in its bookkeeping; can make Rails startup 2.2x faster
https://bugs.ruby-lang.org/issues/7158#change-35813

Author: gregprice (Greg Price)
Status: Closed
Priority: High
Assignee: h.shirosaki (Hiroshi Shirosaki)
Category: core
Target version: 2.0.0
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35409) [i686-linux]


=begin
Starting a large application in Ruby is slow.  Most of the startup
time is not spent in the actual work of loading files and running Ruby
code, but in bookkeeping in the 'require' implementation.  I've
attached a patch series which makes that bookkeeping much faster.
These patches speed up a large Rails application's startup by 2.2x,
and a pure-'require' benchmark by 3.4x.

These patches fix two ways in which 'require' is slow.  Both problems
have been discussed before, but these patches solve the problems with
less code and stricter compatibility than previous patches I've seen.

* Currently we iterate through $LOADED_FEATURES to see if anything
  matches the newly required feature.  Further, each iteration
  iterates in turn through $LOAD_PATH.  Xavier Shay spotted this
  problem last year and a series of patches were discussed
  (in Issue #3924) to add a Hash index alongside $LOADED_FEATURES,
  but for 1.9.3 none were merged; Masaya Tarui committed Revision r31875,
  which mitigated the problem.  This series adds a Hash index,
  and keeps it up to date even if the user modifies $LOADED_FEATURES.
  This is worth a 40% speedup on one large Rails application,
  and 2.3x on a pure-'require' benchmark.

* Currently each 'require' call runs through $LOAD_PATH and calls
  rb_file_expand_path() on each element.  Yura Sokolov (funny_falcon)
  proposed caching this last December in Issue #5767, but it wasn't
  merged.  This series also caches $LOAD_PATH, and keeps the cache up
  to date with a different, less invasive technique.  The cache takes
  34 lines of code, and is worth an additional 57% speedup in
  starting a Rails app and a 46% speedup in pure 'require'.


== Staying Compatible

With both the $LOADED_FEATURES index and the $LOAD_PATH cache,

* we exactly preserve the semantics of the user modifying $LOAD_PATH
  or $LOADED_FEATURES;

* both $LOAD_PATH and $LOADED_FEATURES remain ordinary Arrays, with
  no singleton methods;

* we make just one semantic change: each element of $LOAD_PATH and
  $LOADED_FEATURES is made into a frozen string.  This doesn't limit
  the flexibility Ruby offers to the programmer in any way; to alter
  an element of either array, one simply reassigns it to the new
  value.  Further, normal path-munging code which only adds and
  removes elements shouldn't have to change at all.

These patches use the following technique to keep the cache and the
index up to date without modifying the methods of $LOADED_FEATURES or
$LOAD_PATH: we take advantage of the sharing mechanism in the Array
implementation to detect, in O(1) time, whether either array has been
mutated.  We cause $LOADED_FEATURES to be shared with an Array we keep
privately in load.c; if anything modifies it, it will break the
sharing and we will know to rebuild the index.  Similarly for
$LOAD_PATH.


== Benchmarks

First, on my company's Rails application, where $LOAD_PATH.size is 207
and $LOADED_FEATURES.size is 2126.  I measured the time taken by
'bundle exec rails runner "p 1"'.

 .                Rails startup time,
 version               best of 5        speedup
 v1_9_3_194             12.197s
 v1_9_3_194+index        8.688s          1.40x
 v1_9_3_194+index+cache  5.538s          2.20x

And now isolating the performance of 'require', by requiring
16000 empty files.

 version            time, best of 5     speedup
 trunk (at r36920)      10.115s
 trunk+index             4.363s          2.32x
 trunk+index+cache       2.984s          3.39x

(The timings for the Rails application are based on the latest release
rather than trunk because a number of gems failed to compile against
trunk for me.)


== The Patches

I've attached four patches:

(1) Patch 1 changes no behavior at all.  It adds comments and
    simplifies a bit of code to help in understanding why patch 3 is
    correct.  42 lines, most of them comments.

(2) Patch 2 adds a function to array.c which will help us tell when
    $LOAD_PATH or $LOADED_FEATURES has been modified.  17 lines.

(3) Patch 3 adds the $LOADED_FEATURES index.  150 lines.

(4) Patch 4 adds the $LOAD_PATH cache.  34 lines.

Reviews and comments welcome -- I'm sure there's something I could do
to make these patches better.  I hope we can get some form of them
into trunk before the next release.  My life has been happier since I
switched to this version because commands in my Rails application all
run faster now, and I want every Ruby programmer to be happier in the
same way with 2.0 and ideally with 1.9.4.

=end



-- 
http://bugs.ruby-lang.org/

In This Thread

Prev Next