Excelsior
A Ruby gem that uses C bindings to read CSV files superfast. I’m totally serial!
Benchmarks
The benchmark is against a 1 million row csv file with an average row length of 55 characters
| csv parser | user | system | total | real |
|---|---|---|---|---|
| Excelsior | 4.440000 | 0.070000 | 4.510000 | ( 4.505559) |
| Ruby 1.9 Built in | 54.160000 | 0.250000 | 54.410000 | ( 55.492567) |
Usage
Parsing an IO Object
1 require 'rubygems' 2 require 'excelsior' 3 rows = [] 4 Excelsior::Reader.rows(File.open('a_csv_file.csv', 'rb')) do |row| 5 rows << row 6 end
Parsing a text stream
1 require 'rubygems' 2 require 'excelsior' 3 rows = [] 4 Excelsior::Reader.rows("first,second,third\n1,2,3") do |row| 5 rows << row 6 end
Get it
Install the gem:
sudo gem install excelsior