Skip to content

Microoptimizations on DateTimeParser - #2990

Open
Henr1k80 wants to merge 9 commits into
JamesNK:masterfrom
Henr1k80:master
Open

Microoptimizations on DateTimeParser#2990
Henr1k80 wants to merge 9 commits into
JamesNK:masterfrom
Henr1k80:master

Conversation

@Henr1k80

Copy link
Copy Markdown

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