James Edward Gray II wrote:
> On Feb 28, 2006, at 7:59 PM, Oliver Cromm wrote:
>
> > The speed difference looks too extreme too me:
> >
> >
> >   caps = []
> >   File.open('caps_u8.dic').each {|line| caps << line.split(';')[0]}
> >
> > => 1.8 seconds
>
> Here you are rolling your own split.
>
> >   require 'rio'
> >   caps = rio('caps_u8.dic').csv(";").columns(0)[].flatten
> >   p caps
> >
> > => 50.9 seconds
>

This is a false comparison. The speedy code will not properly parse
many CSV files.

For example, the following is a legal line from a CSV file:

  "Field 1","Hello, World", "Field 3"

The comma embedded in the second field precludes the use of a simple
+split+. In addition, the speedy version would include the double
quotes in the field value -- which is incorrect.

-Christopher