On 10/26/05, TRANS <transfire / gmail.com> wrote:
> >
> > The implementation I had in mind would use the Ruby String methods
> > rather than direct manipulation.  It would be short and fairly easy to
> > read.
>
> Well someone might want to give that a go. I tightened Pathname up
> "real good" using an Array [...]
>
> But the speed only improved about 20%. I got my benchmark below a
> second, but that's still almost 5 times slower than File.join.

That's a shame.  It's worth investigating exactly what causes the
slowdown.  It's easy to guess, though: File.join is written in C;
Pathname#join is written in Ruby :)

> Also I noticed that Pathname depends on File, Dir, FileUtils, FileTest
> and Find. While I'd imagine there be some dependency (especially to
> deal with cross-platform issues), this is much less self contained
> then I imagined it would be.

It's little more than a uniform OO interface to all those libraries,
which is a lovely thing.

It's the way Ruby's IO _should_ have been designed in the first place
(IMHO, of course).  The File etc. classes give rise to very procedural
code in comparison with Pathname.  Therefore it would be nice to
remove impediments to its usage.

Gavin