Skip to content

Fix slow type inference in FacebookResetPasswordViewController#2586

Merged
amy-at-kickstarter merged 4 commits into
mainfrom
bug/adyer/slowest-vc-method
Aug 12, 2025
Merged

Fix slow type inference in FacebookResetPasswordViewController#2586
amy-at-kickstarter merged 4 commits into
mainfrom
bug/adyer/slowest-vc-method

Conversation

@amy-at-kickstarter

@amy-at-kickstarter amy-at-kickstarter commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

📲 What

Fix compile warning about bindStyles in FacebookResetPasswordViewController being 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.bar instead of \.bar simplifies 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!

@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review August 7, 2025 16:32
@amy-at-kickstarter amy-at-kickstarter requested review from a team, scottkicks and stevestreza-ksr and removed request for a team August 7, 2025 16:32

@stevestreza-ksr stevestreza-ksr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively just remove all the Prelude ;)

@amy-at-kickstarter

Copy link
Copy Markdown
Contributor Author

Alternatively just remove all the Prelude ;)

SOON 😉

@amy-at-kickstarter amy-at-kickstarter merged commit 7e54d0e into main Aug 12, 2025
5 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the bug/adyer/slowest-vc-method branch August 12, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants