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

Reduce Swift compile time. #467

Merged
merged 1 commit into from
Oct 5, 2016
Merged

Reduce Swift compile time. #467

merged 1 commit into from
Oct 5, 2016

Conversation

frankrausch
Copy link
Contributor

I profiled Kingfisher’s compile time after reading this:
http://irace.me/swift-profiling

With this small change, I was able to speed up compile time dramatically.

Before:

2517.2ms  Kingfisher/Sources/String+MD5.swift:213:10  func calculate() -> [UInt8]
2444.7ms  Kingfisher/Sources/String+MD5.swift:282:20  (closure)
2320.0ms  Kingfisher/Sources/String+MD5.swift:213:10  func calculate() -> [UInt8]
2251.4ms  Kingfisher/Sources/String+MD5.swift:282:20  (closure)
113.8ms Kingfisher/Sources/String+MD5.swift:129:6 func toUInt32Array(_ slice: ArraySlice<UInt8>) -> Array<UInt32>
108.5ms Kingfisher/Sources/String+MD5.swift:129:6 func toUInt32Array(_ slice: ArraySlice<UInt8>) -> Array<UInt32>
47.5ms  Kingfisher/Sources/String+MD5.swift:63:6  func arrayOfBytes<T>(_ value: T, length: Int? = default) -> [UInt8]
46.4ms  Kingfisher/Sources/String+MD5.swift:63:6  func arrayOfBytes<T>(_ value: T, length: Int? = default) -> [UInt8]
39.8ms  Kingfisher/Sources/String+MD5.swift:69:86 (closure)
39.3ms  Kingfisher/Sources/String+MD5.swift:69:86 (closure)
…

After:

123.0ms Kingfisher/Sources/String+MD5.swift:213:10  func calculate() -> [UInt8]
103.6ms Kingfisher/Sources/String+MD5.swift:129:6 func toUInt32Array(_ slice: ArraySlice<UInt8>) -> Array<UInt32>
101.5ms Kingfisher/Sources/String+MD5.swift:129:6 func toUInt32Array(_ slice: ArraySlice<UInt8>) -> Array<UInt32>
73.1ms  Kingfisher/Sources/String+MD5.swift:213:10  func calculate() -> [UInt8]
45.3ms  Kingfisher/Sources/String+MD5.swift:63:6  func arrayOfBytes<T>(_ value: T, length: Int? = default) -> [UInt8]
45.2ms  Kingfisher/Sources/String+MD5.swift:63:6  func arrayOfBytes<T>(_ value: T, length: Int? = default) -> [UInt8]
39.2ms  Kingfisher/Sources/String+MD5.swift:69:86 (closure)
38.4ms  Kingfisher/Sources/String+MD5.swift:69:86 (closure)
16.1ms  Kingfisher/Sources/String+MD5.swift:157:19  mutating func next() -> ArraySlice<UInt8>?
12.2ms  Kingfisher/Sources/String+MD5.swift:39:21 get {}
…

@codecov-io
Copy link

codecov-io commented Oct 5, 2016

Current coverage is 73.57% (diff: 100%)

Merging #467 into master will increase coverage by 0.04%

@@             master       #467   diff @@
==========================================
  Files            21         21          
  Lines          2210       2214     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           1625       1629     +4   
  Misses          585        585          
  Partials          0          0          

Powered by Codecov. Last update 434ac82...5e4dd30

@onevcat
Copy link
Owner

onevcat commented Oct 5, 2016

Wow, incredible! Thanks for it.
I will also read that article later. Thanks for letting me know it!

@onevcat onevcat merged commit 144e9b8 into onevcat:master Oct 5, 2016
rain2540 pushed a commit to rain2540/Kingfisher that referenced this pull request Feb 28, 2017
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