JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6610

JRuby 1.9 mode require does multiple requires and extra file system searching

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.6.7
    • Fix Version/s: None
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Our 1.9 logic seems to be searching through filesystem to try and determine the canonical path we are storing our loads under in features. It appears MRI is not doing this. This little program (make an 'a' and 'b' directory both containing a 'test.rb' with different contents) demonstrates us double loading where MRI will not (tried against MRI 1.9.2 and 1.9.3):

      $LOAD_PATH << 'a'
      require 'test'
      $LOAD_PATH[0] = 'b'
      require 'test'
      

      Our resolution process may be a significant load cost for things like rails which has a lot of the same requires sprinkled around their codebase.

        Issue Links

          Activity

          Charles Oliver Nutter made changes -
          Field Original Value New Value
          Fix Version/s JRuby 1.7.0.pre2 [ 18527 ]
          Fix Version/s JRuby 1.7.0.pre1 [ 17049 ]
          Charles Oliver Nutter made changes -
          Link This issue is duplicated by JRUBY-6797 [ JRUBY-6797 ]
          Hide
          Charles Oliver Nutter added a comment -

          I spent a little time investigating this the other day.

          I could not see how MRI would be able to check loaded features without re-searching and canonicalizing paths, but I also recognize that it does not find new files on the load path. The two features seem mutually exclusive, so something has to give.

          Show
          Charles Oliver Nutter added a comment - I spent a little time investigating this the other day. I could not see how MRI would be able to check loaded features without re-searching and canonicalizing paths, but I also recognize that it does not find new files on the load path. The two features seem mutually exclusive, so something has to give.
          Charles Oliver Nutter made changes -
          Fix Version/s JRuby 1.7.0 [ 18624 ]
          Fix Version/s JRuby 1.7.0.pre2 [ 18527 ]
          Charles Oliver Nutter made changes -
          Fix Version/s JRuby 1.7.1 [ 18842 ]
          Fix Version/s JRuby 1.7.0 [ 18624 ]
          Thomas E Enebo made changes -
          Fix Version/s JRuby 1.7.2 [ 19008 ]
          Fix Version/s JRuby 1.7.1 [ 18842 ]
          Hide
          Ben Browning added a comment -

          Here's a gist with a proposed patch and a benchmark script to show the performance difference when requiring the same thing more than once - https://gist.github.com/15d8f04c1dbf06528867

          Show
          Ben Browning added a comment - Here's a gist with a proposed patch and a benchmark script to show the performance difference when requiring the same thing more than once - https://gist.github.com/15d8f04c1dbf06528867
          Thomas E Enebo made changes -
          Fix Version/s JRuby 1.7.3 [ 19009 ]
          Fix Version/s JRuby 1.7.2 [ 19008 ]
          Thomas E Enebo made changes -
          Fix Version/s JRuby 1.7.4 [ 19106 ]
          Fix Version/s JRuby 1.7.3 [ 19009 ]
          Charles Oliver Nutter made changes -
          Fix Version/s JRuby 1.7.4 [ 19106 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Thomas E Enebo
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: