07.02.2012 05:59, Trans §á§Ú§ê§Ö§ä: > I recently benchmarked require vs require_relative, and I was > surprised to see no noticeable difference between the two. This > doesn't make a whole lot of sense to me since relative require > shouldn't have to look anything up via RubyGems or the $LOAD_PATH, so > there should be some appreciable difference, even if relatively small. > > So what am I missing? Is the implementation not optimized? Or is there > something that has to happen behind the scenes that voids any load > time gain? Or were my benchmarks anomalous for some reason? > > Note: My benchmarks were simple timing how long it takes to load the > test-unit library, which has approx 20 or so files to load, vs the > same library with all the requires changed to relative requires. Both > averaged around 0.075 seconds. Someone told me that my patches are not needed cause of `require_relative`. Could you test with my patches? Against trunk: https://github.com/ruby/ruby/pull/66 ( http://bugs.ruby-lang.org/issues/5427 ) https://github.com/ruby/ruby/pull/68 ( http://bugs.ruby-lang.org/issues/5767 ) Against 1.9.3-p0 : https://gist.github.com/1484985 ( or https://gist.github.com/1688857 - combined with other my patches ) Yura.