Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Refactor and optimize loaded features #5763
For recent work on load/require and autoload, I ported over some logic from CRuby to manage the cache of loaded features. This cache builds up a mapping of all subpaths, considering load paths, canonicalized paths, and so on, in order to make future requires of any similar path detect the already-loaded feature. In CRuby, this cache has been carefully crafted to avoid allocating too many extra strings, sharing the backing store for the path among all entries. We currently do not do this, and I believe this may be slowing down load logic instead of speeding it up as the cache should do.
Before releasing JRuby 9.2.8, we will need to revisit this logic and ensure we're only doing the minimum allocation and work necessary to maintain and use the loaded features cache.