Xcode going sloooow ! #79
Replies: 3 comments 4 replies
-
It is expected that Xcode will have more work to do when inferring the types, as it has to check all the possible solutions. The sluggishness is not desired, but can happen unfortunately in certain conditions where Swift has difficulties resolving types. |
Beta Was this translation helpful? Give feedback.
-
Just casting first prefix as Substring helped a lot thanks |
Beta Was this translation helpful? Give feedback.
-
@fatlazycat Thanks for starting this discussion! It's actually a pretty interesting issue, and it'd be good for us to document the problem. If we turn on some build settings, we can get some good feedback on how slow to compile an expression is: swiftSettings: [
.unsafeFlags([
"-Xfrontend", "-warn-long-expression-type-checking=10",
])
] And yup, the expression in question is painfully slow: While it might seem that If we attempt to map each Trying to avoid the closure in each If we use So the overload space of What if we converted the substring to a string a different way? Like string interpolation? Almost instantaneous. Comparing this to your solution of explicitly providing the generic in We get something that's also quite fast. And for completeness' sake, if we specify So the problem appears to be a combination of a generic Maybe there's some way of improving our APIs to avoid this gotcha, and maybe we can better document this limitation in the meantime. It's also quite possible that there are improvements that could be made in the Swift compiler, so we may file a bug report to see if they think this can be improved. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
More of an observation than anything.
If i let Xcode do type inference on the code below it goes very slow compared to normal operation.
If I put in the types and do
compilation etc is back to normal.
This expected ?
I was trying to parse rows such as
Perhaps there is a better way than the parser I had ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions