Oliver Cromm <lispamateur / internet.uqam.ca> writes:

> The speed difference looks too extreme too me:

Just guessing:

>   caps = []
>   File.open('caps_u8.dic').each {|line| caps << line.split(';')[0]}

One line read to memory at a time.
One line splitted at a time.
One element inserted at a time.

> => 1.8 seconds
>
>   require 'rio'
>   caps = rio('caps_u8.dic').csv(";").columns(0)[].flatten
>   p caps
>
> => 50.9 seconds

All lines read to memory at once.
All lines splitted at once.
All fields except the first thrown away.
Another copy due to flatten.

> What exactly is so slow here? It's not the /flatten/. 
> Am I using Rio in a particularly dumb way?

No, it's just more memory usage and heavier calculations.

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org