not invented here

Some neat libraries that have happened recently; not by me.


I found CSVScan on the RAA only a few days after I wrote my own fast CSV parser. CSVScan itself had been released only a few days before. It’s Ragel-based, and implements the most common CSV “spec”, unlike my Ccsv, which only supports a constrained format.

Ccsv is faster, but not enough to care about. Here’s a benchmark yielding 1,000,000 rows from a file:

user system total
Ccsv 1.780000 0.030000 1.810000
CSVScan 2.280000 0.050000 2.330000
LightCsv 11.680000 0.110000 11.790000
FasterCSV 35.340000 0.200000 35.540000
CSV 115.050000 0.440000 115.490000

I’m surprised it took until Sep 2007 for someone to write a C CSV parser.

Ccsv development is halted; if I had known about CSVScan, I wouldn’t have written it. It would be nice, though, if CSVScan had a foreach method and a gem version.

If you’re learning, Ccsv still makes an excellent example of a plain C extension. CSVScan makes an excellent example of a Ragel extension.


Ara wrote a leak detector called Dike, which bears investigation. Using the object finalizer is a good idea. Probably the ideal leak detector will be lifecycle-based (sort of like Dike) instead of snapshot-based (like BleakHouse), but C-implemented (like BleakHouse) so that we can guarantee we aren’t introducing leaks in the attempt to track them, and so that it’s fast enough to use in live production environments.

If we do lifecycle tracking we should be able to identify the exact line of app code that spawns the leaks.

ruby east

I was at the Ruby East conference today. It was good. Mike Mangino gave an excellent talk on mocking. Also, I met Gregory Brown in real life. Good guy; hair longer than mine.


Despite Mike’s talk, I’ve added an integration suite to Ultrasphinx. No mocks here. I actually removed some of the unit tests; for a local service consumer like Ultrasphinx, the integration suite is definitely the way to go.

Now I can approach full coverage in the plugin itself instead of relying on CHOW as the integration test—that was definitely not optimal. Also I can spawn mongrels in setup and kill them in teardown, which lets me test awkward situations like development environment class reloading.

Mark Lane contributed the sample app, so it’s still NIH even though I wrote the helper and initial tests. Good times.

2 responses