Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 0.9.1
-
Fix Version/s: JRuby 0.9.8
-
Component/s: Java Integration
-
Labels:None
-
Environment:Windows, Rails 1.1.6, Java 1.3-1.5
Description
When I start up a Rails app under JRuby with a large classpath, startup takes over an hour on a 2Ghz P4. Start-up is ten seconds or less with only the large classpath, or only Rails.
Large classpath = 100+ jars and class folders.
The immediate culprit seems to be Java's ClassLoader.getResource(path). Typically, this call takes less than a millisecond, but if 'path' starts with a drive letter, the call takes at least 700 ms, and seems to get slower over time. This seems to happen on many current versions of Java.
Paths that start with 'C:' are slow; paths that start with '/C:' are fast.
Dirty workaround: patch JRuby's LoadService to not on the classpath look for resources start with '[a-z]:'
The JRuby resource loading code appears over-complicated to me.
Updating title to be more generic. We need a general refactoring of the loading heuristic so that commonly-accessed resources on cheap load locations (like filesystem) are fast-pathed before slow load paths like classloader resources or URL/JAR loads.
A couple ideas: