Fix slow type inference in FacebookResetPasswordViewController#2586
Merged
Conversation
stevestreza-ksr
approved these changes
Aug 7, 2025
stevestreza-ksr
left a comment
Contributor
There was a problem hiding this comment.
Alternatively just remove all the Prelude ;)
Contributor
Author
SOON 😉 |
scottkicks
approved these changes
Aug 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📲 What
Fix compile warning about
bindStylesinFacebookResetPasswordViewControllerbeing very slow to type check.This changes makes the method compile in 27.23ms instead of 20+ seconds.
🤔 Why
I've been doing a little background exploration to understand if deprecating Prelude would speed up our builds - and if so, how much and why.
This PR came out of that exploration; I was reading more about the Swift type checker and wanted to understand why this function was so slow. My best guess is that the type checker solver has a hard time resolving these key paths (with very common names) to a specific type; defining them as
Foo.Lens.barinstead of\.barsimplifies that for the compiler. When they're appended together as one long expression, the compiler panics.This change has a trivial impact, but I thought it was neat - since I fixed it, I figured I might as well ship the fix!