Skip to content

Benchmark CSV parsing with headers - #384

Open
Sinkleberg wants to merge 1 commit into
ruby:mainfrom
Sinkleberg:codex/parse-headers-benchmark
Open

Sinkleberg wants to merge 1 commit into
ruby:mainfrom
Sinkleberg:codex/parse-headers-benchmark

Conversation

@Sinkleberg

Copy link
Copy Markdown

Adds a benchmark that parses the same CSV input as arrays and as a table with headers. Run it with rake benchmark:parse_headers or rake benchmark:parse_headers:small.

In a separate local profile on Ruby 3.3.13, 1,000 synthetic records with 10 columns took a median of 2.27 ms with headers, 1.45 ms as arrays, and 1.67 ms with HoneyFormat over seven runs each. I checked that the headers and field values matched. A separate trace counted one CSV::Row#initialize call per record.

The benchmark ran on csv 3.3.0 and master. All 535 tests passed.

Refs #59.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant