Npgsql: Support reading/writing Span to/from bytea

Created on 15 Nov 2017  路  1Comment  路  Source: npgsql/npgsql

With the new Span introduced in C# 7.2, we should support it for PostgreSQL bytea.

enhancement performance

Most helpful comment

Some notes:

  • Wait for 2.1, because right now there are no APIs for reading/writing Spans (e.g. in Stream)
  • Possibly add an optimization for bytea for reading a ReadOnlySpan which points into the Npgsql buffer, in cases where the entire value fits in the buffer. That's zero-copy bytea reading, pretty cool.
  • Unrelated to bytea - remove the tempCharBuffer used for skipping, allocate on the stack instead.

>All comments

Some notes:

  • Wait for 2.1, because right now there are no APIs for reading/writing Spans (e.g. in Stream)
  • Possibly add an optimization for bytea for reading a ReadOnlySpan which points into the Npgsql buffer, in cases where the entire value fits in the buffer. That's zero-copy bytea reading, pretty cool.
  • Unrelated to bytea - remove the tempCharBuffer used for skipping, allocate on the stack instead.
Was this page helpful?
0 / 5 - 0 ratings