From: Robert Klemme Date: 2005-10-30T21:52:17+09:00 Subject: Re: Faster CSV parsing William James wrote: > Gavin Kistner wrote: >> On Oct 29, 2005, at 10:07 PM, William James wrote: >>> ## Read, parse, and create csv records. >>> >>> # The program conforms to the csv specification at this site: >>> # http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm >>> # The only extra is that you can change the field-separator. >>> # For a field-separator other than a comma, for example >>> # a semicolon: >>> # Csv.fs=";" >>> # >>> # After a record has been read and parsed, >>> # Csv.string contains the record in raw string format. >> >> Thanks for sharing this. You claim 'faster' CSV parsing. Faster than >> what, > > Than Ruby's standard-lib csv.rb. > >> and by how much? Got any benchmark results to share? > > For my test file of 1,964,211 bytes, it's about 6.4 times as fast. I didn't look too closely at it nor did I test it but your use of class variables seems not necessary here. I'd prefer to transform them into instance variables. Makes your code much more robust... Kind regards robert