[swift-users] Need help with compile times (type inference?)

Daniel Dunbar daniel_dunbar at apple.com
Fri Jan 22 16:23:04 CST 2016


It doesn't help with this problem, but I use:
  -Xfrontend -solver-memory-threshold -Xfronted <SOME-BIG-NUMBER-BUT-LESS-THAN-THE-DEFAULT>
as a way to cause the compiler to give up sooner.

This helps some to identify new troublesome code as it is written, but unfortunately doesn't really help with speeding up code like you posted.

 - Daniel

> On Jan 22, 2016, at 12:25 PM, David Turnbull via swift-users <swift-users at swift.org> wrote:
> 
> I'm trying to improve compile times in my project. I've been using "-Xfrontend -debug-time-function-bodies" to find to sore spots. Here's something that takes 1300ms to compile:
> 
> public func ortho<T:FloatingPointScalarType>
>     (left:T, _ right:T, _ bottom:T, _ top:T) -> Matrix4x4<T>
> {
>     let t0:T = T(0)
>     let t1:T = T(1)
>     let t2:T = T(2)
> 
>     let r00:T = t2 / (right - left)
>     let r11:T = t2 / (top - bottom)
> 
>     let r30:T = -(right + left) / (right - left)
>     let r31:T = -(top + bottom) / (top - bottom)
> 
>     return Matrix4x4<T>(
>         r00, t0,  t0,  t0,
>         t0,  r11, t0,  t0,
>         t0,  t0,  -t1, t0,
>         r30, r31, t0,  t1
>     )
> }
> 
> I'm not sure what to do from here. My program is unavoidably math heavy. Every new line of code adds about 60ms of compile time. And that's after I spend time typing in hints and splitting up the arithmetic.
> 
> -david  https://github.com/AE9RB/SwiftGL <https://github.com/AE9RB/SwiftGL>_______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160122/3a67762b/attachment.html>


More information about the swift-users mailing list