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

Optimize GetMD5 function #7575

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Optimize GetMD5 function #7575

merged 1 commit into from
Apr 12, 2022

Conversation

Bond-009
Copy link
Member

@Bond-009 Bond-009 commented Apr 9, 2022

Method Mean Error StdDev Gen 0 Allocated
Old 795.1 ns 5.90 ns 4.61 ns 0.0029 312 B
HashDataInsteadOfComputeHash 396.1 ns 1.36 ns 1.13 ns 0.0014 152 B
StackallocedDestination 395.8 ns 1.80 ns 1.60 ns 0.0014 152 B
RentBuffer 498.8 ns 3.35 ns 2.97 ns - 40 B

Tested multiple possible speedups, in the end the simplest of them all won

|                       Method |     Mean |   Error |  StdDev |  Gen 0 | Allocated |
|----------------------------- |---------:|--------:|--------:|-------:|----------:|
|                          Old | 795.1 ns | 5.90 ns | 4.61 ns | 0.0029 |     312 B |
| HashDataInsteadOfComputeHash | 396.1 ns | 1.36 ns | 1.13 ns | 0.0014 |     152 B |
|      StackallocedDestination | 395.8 ns | 1.80 ns | 1.60 ns | 0.0014 |     152 B |
|                   RentBuffer | 498.8 ns | 3.35 ns | 2.97 ns |      - |      40 B |

Tested multiple possible speedups, in the end the simplest of them all won
@crobibero crobibero merged commit c7fd7a2 into jellyfin:master Apr 12, 2022
@Bond-009 Bond-009 deleted the md5 branch April 12, 2022 19:49
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