File.isFile() is incredibly slow on MacOS
-----------------------------------------
Key: JRUBY-2914
URL: http://jira.codehaus.org/browse/JRUBY-2914
Project: JRuby
Issue Type: Improvement
Components: Performance
Affects Versions: JRuby 1.1.3
Environment: MacOS Leopard 10.5, JVM 1.5 and 1.6 from Apple
Reporter: Greg Fodor
Attachments: load_service.diff
Doing some thread dumps revealed that the calls to File.isFile() inside of
LoadService is incredibly slow on MacOS Leopard. By removing these calls and
using a cache of the result, performance using railgun for startup (loading
gems, etc.) improved by 75% or so. We should probably do a TTL cache of these
bits or alternatively take another approach to determining if the path points
to a real file.
The bottleneck in the thread dump is the canonicalPath call, I found this:
http://lists.apple.com/archives/Java-dev/2001/Jun/msg01013.html
Which may or may not be relevant, since it's so long ago.
I've attached a patch against 1.1.3 that uses a static cache but this isn't
ideal obviously since it will be stale and also doesn't improve the initial
startup time. There are also other places were File.isFile is likely being
called, this too may be worth fixing.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email