OData / AspNetCoreOData

ASP.NET Core OData: A server library built upon ODataLib and ASP.NET Core
Other
454 stars 161 forks source link

Perf: Creating OData properties is expensive #1109

Open habbes opened 9 months ago

habbes commented 9 months ago

During serialization, a relatively high amount of CPU is used to create ODataProperty instances that are used to populate ODataResource objects. This is performed in the ODataSerializerPropertyHelper.CreateProperty method.

The most of the cost come's from the property's EDM serializer's call to CreateODataValue.

image

The ODataPrimitiveSerializer.CreateODataValue:

The ODataEnumSerializer.CreateODataValue:

julealgon commented 9 months ago

@habbes what framework version are you targeting on those tests?

habbes commented 9 months ago

@julealgon the tests were running on net7.0, should try them on net8.0 as well.

julealgon commented 9 months ago

@julealgon the tests were running on net7.0, should try them on net8.0 as well.

I was going to suggest that considering how many perf enhancements there were in .NET8. Would be curious to compare the results.