From: Nikolai Weibull Date: 2011-09-11T18:27:51+09:00 Subject: [ruby-core:39468] Re: File.realpath behavior questions On Sun, Sep 11, 2011 at 02:23, KOSAKI Motohiro wrote: > 2011/9/11 Luis Lavena : >> Asking this because we are not reading and resolving symlink, >> junctions or hardlinks in Ruby for Windows, so doing the entire >> traversal and check seems a bit expensive (several stat() calls) >> >> This means: build absolute path, expand if required, combine with >> GetFileAttributesEx to check for existance. >> >> Would this approach be acceptable? > I have no strong opinion. But I have a little curious. Why do you want > to avoid several stat()? unix platform also use such a bit expensive check > and now works. Because stat() is EXTREMELY slow on Windows. I mean, not even funny slow. I don���t know if the following related problem has been fixed, but in 1.9.2, Ruby would call realpath on all paths about to be added to $LOADED_FEATURES (as $LOADED_FEATURES now includes the real absolute path, not the relative path), which made load times excruciatingly slow. I don���t know if a cache was added since, but if it hasn���t then that would save a lot of time when loading Ruby on Windows (if Luis suggestion above isn���t good enough).