You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our JSON reading/writing uses Utf8JsonReader/Writer, but currently always does so over UTF16 strings. In other words, for reading we get a string out of DbDataReader, and then encode it into UTF8, build a MemoryStream over that, and then read from that stream (we do something similarly inefficient for writing).
For SQL Server, where a UTF8 property is configured, we should be able to get binary data directly out of SqlClient, possibly in the form of a stream. Assuming that's the case, we can parse JSON directly out of that stream without the current UTF16 conversions and copying.
We can also consider making string properties UTF8 by convention on SQL Server when they're a JSON container (but consider the breaking change and how the transition would work). Note also that UTF8 support was introduced in SQL Server 2019.
For PostgreSQL, UTF8 is configured at the database level, and is also the default; we should enable this optimization there as well.
The text was updated successfully, but these errors were encountered:
Our JSON reading/writing uses Utf8JsonReader/Writer, but currently always does so over UTF16 strings. In other words, for reading we get a string out of DbDataReader, and then encode it into UTF8, build a MemoryStream over that, and then read from that stream (we do something similarly inefficient for writing).
For SQL Server, where a UTF8 property is configured, we should be able to get binary data directly out of SqlClient, possibly in the form of a stream. Assuming that's the case, we can parse JSON directly out of that stream without the current UTF16 conversions and copying.
We can also consider making string properties UTF8 by convention on SQL Server when they're a JSON container (but consider the breaking change and how the transition would work). Note also that UTF8 support was introduced in SQL Server 2019.
For PostgreSQL, UTF8 is configured at the database level, and is also the default; we should enable this optimization there as well.
The text was updated successfully, but these errors were encountered: