Skip to content

Swift 4, Xcode 9 struggles badly to compile #5

Description

@SuperWomble

Hi! Firstly, thanks for the project. It's very helpful.

I've been running the code using the long expressions flag, to check where Swift is dying in my code, and it's flagged BezierString, due to the use of multiple-statements on one line.

Some of the lines in Geometry.swift take up to 6 seconds to compile on a 2015 MBP, using Xcode 9 GM.

e.g.

let y: CGFloat = CGFloat(CGFloat(CGFloat(p1.x * p2.y) - CGFloat(p1.y * p2.x)) * CGFloat(p3.y - p4.y) - CGFloat(p1.y - p2.y) * CGFloat(CGFloat(p3.x * p4.y) - CGFloat(p3.y * p4.x))) / CGFloat(CGFloat(p1.x - p2.x) * CGFloat(p3.y - p4.y) - CGFloat(p1.y - p2.y) * CGFloat(p3.x - p4.x))

By separating these out in to their own statements, compiling returns to usual speeds. I'd post the code here, but my code separation is terrible: I don't really know what the code is doing so my naming is random.

For the flag, see:

https://www.jessesquires.com/blog/measuring-compile-times-xcode9/

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions