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

Microoptimizations on DateTimeParser #2990

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Henr1k80
Copy link

I have reduced the size of the DateTimeParser struct that is being copied when calling CreateDateTime

The reduced size of the JIT assembly can be seen here
(Remove : byte on the enum & change byte/ushort fields to int)
Works for both Framework and .NET 8

Optimized the time verification, hour is very likely to be different than 24, minute & seconds are less likely to be 0, so we can exit earlier out of the checks.

Reusing the start + 1 calculation in Parse2Digit saves one line of JIT assembly 😅

Optimized some benchmarks so they mainly test (de)serialization & added one for deserialization of dates.
Fixed some unit tests for da-DK culture.
Gitignore Rider files.

DateTimeParser haven't changed in 9 years, so these changes can be backported to the many versions used

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.

1 participant