[swift-users] Need help with compile times (type inference?)
David Turnbull
dturnbull at gmail.com
Fri Jan 22 14:25:31 CST 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160122/a0faa96d/attachment.html>
More information about the swift-users
mailing list