[Minor optimisation] Potential for optimisation in WriteToServer (SqlMetaDataPriv.IsNullable) #1076
Labels
💡 Enhancement
Issues that are feature requests for the drivers we maintain.
📈 Performance
Issues that are targeted to performance improvements.
Hello,
While working on a project I have observed through DotTrace an opportunity to quickly get some better performance in
WriteToServer
:Framework version : Net Framework 4.7.2
Microsoft.Data.SqlClient version : 2.1.2
As one can see, the
HasFlag
method used inSqlMetaDataPriv.IsNullable
triggers some boxing and extra computation. I guess a solution like the one mentioned here https://medium.com/@arphox/the-boxing-overhead-of-the-enum-hasflag-method-c62a0841c25awould result in some interesting performance gain as overall the method takes 0.41% of 9.18%, so ~4.5% of the
WriteToServer
method). This proportion could technically be higher sinceGetValueFromSourceRow
calls theIDataReader
supplied by the client code, whose performance could be better than the one from my example above and hence increase the relative proportion ofConvertValue
andIsNullable
.The text was updated successfully, but these errors were encountered: