You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/blog/2026-02-06-performance-improvements.mdx
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,9 @@ hide_table_of_contents: false
9
9
10
10

11
11
12
-
As we move closer to a stable release of Pyrefly, our efforts have moved from expanding the language server’s capabilities to tackling performance edge cases. Recently, our friends at Astral [alerted us to a specific edge case](https://astral.sh/blog/ty) that is a great example of the kind of issues we’ve been aiming to uncover. The specific examples Astral highlighted showed that Pyrefly was taking multiple seconds to recheck files after saving a load-bearing file. This is much slower than normal (when tested across Meta’s codebases, Pyrefly usually takes less than 10 milliseconds to recheck files after saving them) and prompted us to investigate further. Now we’d like to share the story of how that edge case brought to light a performance bottleneck which led us to rethink our underlying approach to diagnostics and dependency tracking, improving Pyrefly’s the speed at which type errors appear by 18x in the process.
12
+
As we move closer to a stable release of Pyrefly, our efforts have moved from expanding the language server’s capabilities to tackling performance edge cases. Recently, our friends at Astral [alerted us to a specific edge case](https://astral.sh/blog/ty) that is a great example of the kind of issues we’ve been aiming to uncover. The specific example Astral highlighted showed that in some edge cases Pyrefly could take multiple seconds to update diagnostics after editing. This is much slower than expected (used across Meta’s codebases, Pyrefly usually takes less than 10 milliseconds to recheck files after saving them) and prompted us to investigate further.
13
+
14
+
Now we’d like to share the story of how that edge case led us to rethink our underlying approach to diagnostics and dependency tracking, improving the speed at which Pyrefly's type errors update by 18x in the process.
13
15
14
16
<!--truncate-->
15
17
@@ -35,7 +37,7 @@ When file A is edited & saved, we recheck A to see if any of its exported types
@@ -107,14 +109,14 @@ Combined, these two optimizations enable Pyrefly to provide updated diagnostics
107
109
preload="auto"
108
110
></video>
109
111
110
-
To see how we benchmarked this, you can check out testing instructions GitHub [here](https://github.com/facebook/pyrefly/pull/2344)
112
+
To see how we benchmarked this, you can check out testing instructions on GitHub [here](https://github.com/facebook/pyrefly/pull/2344)
111
113
112
114
## What’s Next?
113
115
114
116
This was a tricky case to fix and we’ve made significant progress, but how fast is fast enough?
115
117
116
118
Speed continues to be a top priority for us on the Pyrefly team. While we’ve addressed the core problem, we’re always on the lookout for opportunities to further optimize performance, so stay tuned for further updates and make sure to regularly update your Pyrefly version. As we move toward v1, we’re carefully weighing additional speed improvements alongside other critical priorities like memory efficiency, bug fixes, and enhanced inference capabilities. Our goal is to deliver the fastest experience possible without compromising on overall functionality.
117
119
118
-
As always if you’ve found a problem, please let us know by [opening a GitHub issue](https://github.com/facebook/pyrefly/issues).
120
+
As always, if you’ve found a problem, please let us know by [opening a GitHub issue](https://github.com/facebook/pyrefly/issues).
119
121
120
122
And if you’ve made it this far, thanks for journeying down this rabbit hole with us\! We hope you give Pyrefly a try if you haven’t already, see you for the next update\!
0 commit comments