Perf: Creating OData properties is expensive
Open
@ElizabethOkerio is already working on this.
Since Nov 28, 2023.
P2
performance
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
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.
The ODataPrimitiveSerializer.CreateODataValue:
- makes expensive calls to ODL's
EdmTypeSemantics, see: https://github.com/OData/odata.net/issues/2807 ODataPrimitiveSerializer.ConverUnsupportedPrimitivesseems to be expensive due to its reliance onType.GetTypeCode(). We should assess whether there are more efficient ways to handle CLR primitive types that are not part of ODL's core primitive types.
The ODataEnumSerializer.CreateODataValue:
- retrieves the
ClrEnumMemberAnnotationfrom the theIEdmModelannotations cache. This model's annotation cache is constant performance hog that does not seem easy to optimize. - does an expensive dictionary lookup to retrieve the EDM enum value corresponding to the CLR enum value
- makes an expensive call to
Enum.ToString()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.