Skip to content

Conversation

@nigrosimone
Copy link
Contributor

@nigrosimone nigrosimone commented Dec 14, 2025

Adds a _parsers array to cache column parsers per column. Reduces repeated calls to _types.getTypeParser() for every row.

@charmander
Copy link
Collaborator

Got a benchmark?

@nigrosimone
Copy link
Contributor Author

I ran a micro-benchmark focused specifically on the result parsing phase, isolating it from network and I/O overhead.

To avoid noise from TCP and libpq I/O, I mocked the pq interface and types.getTypeParser() so the benchmark measures only the cost of:

  • building fields
  • building rows
  • parsing values

The mock generates a result set of 10,000 rows × 10 columns.
Both implementations run against the exact same mocked data and parser logic.

Results (ops/sec):

  • PR: ~397 ops/s
  • master: ~341 ops/s

That’s roughly a +16% improvement in this isolated scenario.

I’m aware this is not an end-to-end benchmark and does not include network latency or query execution time, but the goal here was to validate that caching parsers removes repeated calls to getTypeParser() and measurably reduces overhead in the hot path of result processing.

see here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants