pathname3 as default pathname
Reported by Stephen Touset | May 21st, 2008 @ 04:07 PM | in 1.0 preview
I've reimplemented Pathname due to shortcomings and speed issues with MRI Pathname and Daniel J. Berger's pathname2.
It's located on GitHub[1]. No gem exists until they fix their gem server.
Benchmarks against MRI show a 3x to 20x speed improvement between most methods. Instantiation is faster, and joins are dozens of times faster.
It does not pass all existing Rubinius specs. About 50 failures are errors due to me not implementing some private methods which were not needed.
There are 7 real test failures. Three of them are non-meaningful (I return a value without extra slashes, and MRI leaves them). Two fail because Pathname is reimplemented based on String, so comparisons against Strings succeed where they used to fail. This is probably a good thing.
The remaining two are differences in opinion about how the method should work. In MRI, each_filename yields every component of the path except for the root directory, which is inconsistent with how ascend and descend work. Mine fixes this inconsistency. The last failure is that they consider "a" + "/b" to return "/b", which I think is unexpected, and should return "/b".
If you need compatibility with MRI, those last two can be reverted to their current semantics. The rest shouldn't be an issue, though.
Comments and changes to this ticket
-
Ryan Davis June 23rd, 2008 @ 06:42 PM
- → Assigned user changed from to Evan Phoenix
Well... we absolutely need compatibility with MRI... maybe we package pathname3 as a packaged gem instead?
I'm assigning to evan so he can pass judgement, not so he can work on it (HINT HINT evan--assign back when you decide what to do).
-

Stephen Touset June 24th, 2008 @ 09:33 AM
Again, I can maintain a branch that keeps (almost) full MRI compliance. Although a few differences likely couldn't be reasonably fixed. Those differences are all cosmetic, though. Things like:
"/foo/bar/baz" instead of "/foo//bar/baz"
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
