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 MD5 String By reduce Function #1183

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

wolfcolony
Copy link

I have a question,in "String+MD5.swift",use “reduce” func may be better than use “map” and “joined” to create MD5 string by an [UInt8],"map" may be cause space complexity O(n) ,it create a temp array [String],Or are there other benefits to using "map" and "joined"?

@onevcat
Copy link
Owner

onevcat commented May 14, 2019

@wolfcolony

Thanks!

I am not sure which is faster, but I guess there should not be too much difference. Any chance to create some benchmark? So we can decide whether we should adopt to reduce instead of map + join.

@onevcat
Copy link
Owner

onevcat commented Jun 3, 2019

Tried to have a benchmark and it shows about 15% faster!

@onevcat onevcat merged commit eb10707 into onevcat:master Jun 3, 2019
skoduricg pushed a commit to rentpath/Kingfisher that referenced this pull request Sep 24, 2021
…educe

Optimize MD5 String By `reduce` Function
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.

2 participants