Reproduction Steps
In Studio v0.519.0.5190432, the editor itself can be ground to a complete halt by editing a script with excessively large and complicated types. Note that this performance drop was not present in previous versions, it seems to be a regression introduced by this latest version of Studio.
To reproduce
The steps here are, yet again, similar to my first report on the type checker.
Create a new ModuleScript in the workspace. It should not have its name changed.
Execute the following script in the command bar. This will set the module to use strict type checking, contain 1000 methods, and each method will cast self to a type representing the module.
local src = "--!strict\nlocal Module = {}\n"
for i = 1, 1000 do
local methodName = "Method" .. tostring(i) .. "()"
src ..= "function Module:" .. methodName .. "\n\tlocal self = self::ModuleType\nend\n"
end
src ..= "type ModuleType = typeof(Module)\n"
src ..= "return Module"
workspace.ModuleScript.Source = src
Open this module in editor. You will notice a harsh slowdown or freeze upon opening it, and no color formatting for a moment.
Create a new line after Line 1. The operation should be slow, taking upwards of just over a second until it updates the text (on my hardware).
Type a comment. The color formatting for the comment should slowly “scroll” over the text.
Key Details
This does NOT require strict checking. This still occurs even with --!nocheck defined. The repro contains strict because this is how all of my scripts operate.
The performance drops are proportional to the amount of elements in the script, such as functions.
The performance drop can be mitigated by changing line 3003 to type ModuleType = any, indicating this may be caused by large types acquired via typeof(). It has not been tested on manually defined large types.
Expected Behavior
I expect no notable performance impact on the editor. It should behave without such drastic slowdowns.
Actual Behavior
This video shows off the reproduction steps in action.
It is not shown in the video, but pressing return or unfocusing from the text area before it is done coloring will cause studio to freeze until it is able to finish.
Issue Area: Studio Issue Type: Freezing Impact: High Frequency: Constantly Date First Experienced: 2022-03-27 00:03:00 (-05:00)
I encountered this issue before in a ModuleScript, for about 2 hours anytime I opened the script caused a memory leak (presumably) that froze my desktop.
I have encountered a similar issue with multiple scripts (server and local) not only ModuleScripts, honestly I am not sure what is causing it, it usually happens when the script has a lot of lines of code, this also happened in multiple games not only one game of mine. This causes the script editor to drop Studio’s framerate and the input and scrolling to be a little laggy when in the script editor, I always thought it was an issue with my pc but apparently other people also have perfomance issues with the script editor.
This is still happening and is pretty debilitating. There is a noticeable delay between typing and the characters becoming colored to match the syntax. If you don’t let the coloring catch up, then autocomplete will not function. For example, if you type “if true then” and press enter, the cursor will not indent to the correct position until about a half second later, at which point the expected “end” and indentation will appear.
This only happens in larger scripts (around 500+ lines), but the majority of my game’s systems are managed in large scripts, so it’s effectively a constant issue. Disabling autocomplete does fix the issue.
Another point of note is that this is happening in scripts of mine without any explicit typing or typeof at all, so the fix in the OP’s script doesn’t apply to mine.
You are my hero. I have a pretty massive server script and it has been nearly impossible for me to edit since when I go one line down it freezes my whole studio.
I have started to experience this issue today. My main script has become incredibly slow and frustrating to work on due to the unresponsiveness. My script is a 1000 line module which really does not make sense for me to split into multiple modules. I have had no issues before today with performance in the script editor, and this is really effecting my workflow.
Not only is the text slow to respond, but the luau autocomplete is also much slower aswell as the syntax highlighting.
MacOS users have been experiencing this for the past 4 years, yet Roblox has never fixed it and only ever told us tough luck. I’d like if Roblox didn’t just help out Windows users for this issue, and helped us too it’s an impossibly difficult workflow on Mac.
And yes, even if there is only a single line in the script editor it’s incredibly laggy.
I am not sure if you’re comprehending what we’re talking about but something was introduced recently that has made studio practically unusable. Single key presses are taking multiple seconds to register while studio is doing some kind of code analysis for autocomplete or colorization.
Here is a realtime gif of me pressing the spacebar a few times on my 4ghz 16 core i9.
@Xan_TheDragon
We have prepared a change that should speed up typechecking requests that are performed in script editor (up to 2x for scripts in strict mode) and a work-around that will limit the time those requests are allowed to take (sadly, it will reduce the type inference quality in complex files).
This update should arrive next week.
However, some cases where delays can be felt still remain and we will be working on further optimizations.
Long-term we plan to eliminate type inference delays from the text input path completely.
Another update was already released this week in Studio 0.521 to improve the situation by preventing requests stacking over each other.
You can already see the difference if you retry your test case.
I just want to add my vote that this bug should be considered live. I’m having a frustrating amount of delays in one of my projects which uses a lot of --!strict typechecking. Each individual ModuleScript isn’t extremely long or complicated like the test case up above, but they do require other ModuleScripts.
Even with the above test case, I still get 600ms lag spikes after typing… basically anything.
There appears to be some kind of Script Analysis happening when it shouldn’t–Possibly contributing to these editor slowdowns.
When I first ran the new update, inserting text in the editor it was unusably slow–Seconds to minutes
for a few characters typed to appear. I disabled all Script Analysis settings I could find, and making sure
I set the checkbox for “this script only” but still editing was still too slow to be usable, so
I thought I’d try closing script tabs, as I generally have many open, to see if it would help– It did.
Admittedly I had a lot open, around 80, but this worked fine on the pre-“docking” version of Studio.
Unfortunately, I’ve found that with just 6 or so tabs open, you start to notice a bit of a slowdown already.
With very large scripts typing is quite delayed and it is super annoying. No matter what settings i turn on or off there is no effect on the performance of the editor
Hey folks, would you mind filing a new bug report with additional details and repro cases if you are still seeing poor script editor performance? Our teams will take a look at those then.