On Sat, Aug 18, 2012 at 11:31 PM, Luis Lavena <
luisl...@gmail.com> wrote:
> Hello folks,
>
> Resuming the conversation around faster File.expand_path for require
> without breaking WEBrick...
>
http://bugs.ruby-lang.org/issues/6836
>
> Latest comments from Usa point out to keep current File.expand_path
> behavior but remove the path expansion from require and such.
>
> I decided to update Fenix code to follow those requirements and put
> again code from Hiroshi that expanded path:
>
>
https://gist.github.com/1734954
>
> And updated the repository with the changes:
>
>
https://github.com/luislavena/fenix
>
> Now File.expand_path solves short to long paths properly, but I
> noticed some slowdowns compared to Ruby itself:
>
>
https://gist.github.com/3387055
>
> Fenix ''
> Fenix '.'
> Fenix '', 'C:/'
> Fenix '~'
> Fenix '~', 'C:/Foo'
>
Hello Luis,
I looked commits. Nice work!
Above slowdown would be cause of calling GetFileAttributesW().
https://github.com/luislavena/fenix/blob/master/ext/fenix/file.c#L318
This makes performance slowdown if the path *exists*. All above cases
are existing path.
I guess performance will be same level as ruby if you remove
GetFileAttributesW().
Removing GetFileAttributesW() might be better.
See also:
https://github.com/luislavena/fenix/pull/2
> Fenix ''
> Fenix '.'
> Fenix '', 'C:/'
About above three cases, we could skip to call FindFirstFileW()
because we can expect they are already long name after
GetFullPathNameW().
> Fenix '~'
> Fenix '~', 'C:/Foo'
About above two cases, it depends on environment variable setting if
the path is short name or long name.
--
Hiroshi Shirosaki