Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ConvertPrimitiveType method #1121

Conversation

ElizabethOkerio
Copy link
Contributor

@ElizabethOkerio ElizabethOkerio commented Dec 4, 2023

The ConvertPrimitive method checks if a primitive is a Date, TimeOfDay, Char, UInt16, UInt32, UInt64. DateTime, char[], XElement and handles them differently.

If a primitive type is not any of these types, then the value is returned.

A lot of checks are done to check for the above-mentioned types which can be avoided if we return the value early if we know the type, we are dealing with is not any of the above-mentioned types that need special processing.

Making this change leads to the following CPU improvements:
Before:
before1
After:
after1

@ElizabethOkerio ElizabethOkerio changed the title update convert primitive type update ConvertPrimitiveType method Dec 4, 2023
@ElizabethOkerio ElizabethOkerio changed the title update ConvertPrimitiveType method Update ConvertPrimitiveType method Dec 4, 2023
@ElizabethOkerio ElizabethOkerio marked this pull request as ready for review December 4, 2023 09:56
Copy link
Member

@xuzhg xuzhg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@KenitoInc KenitoInc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ElizabethOkerio ElizabethOkerio merged commit e433932 into OData:main Dec 6, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants