Construct-bugs icon indicating copy to clipboard operation
Construct-bugs copied to clipboard

Preview Launch: "Validing Script" phase introduced with Monaco is super slow (no repro)

Open OverboyDev opened this issue 8 months ago • 1 comments

Problem description

On my project, a Preview Launch of my game takes 10 extra seconds on C3 versions that require to use Monaco (r430+), due to the new "Validating Script" phase

It makes the workflow to work on my game not efficient enough so for now I stick with r429 + use CodeMirror option

This is probably a real world project issue, maybe it happens when many scripts are referencing each other?

More details

I don't even use the builtin script editor, so it is really frustratring that C3 forces me to wait for some validation i don't need, even if that time was optimized to only take 2 second instead of 10, it still wouldn't be ideal. (I launch the preview dozens and dozens of time per day, and it is still taking 10 seconds in previous versions instead of 20+ with Monaco)

What is your opinion about adding an option "Use External Script Editor" to skip this phase? (This option could also be useful for potential extra UX enhacements such as suggesting to open the script with default app when double clicking it instead of opening it in C3 editor)

Attach a .c3p

Steps to reproduce

Observed result

Expected result

Affected browsers/platforms:

First affected release:

System details

View details

PASTE HERE

OverboyDev avatar May 02 '25 08:05 OverboyDev

For reference - see forum thread discussion: https://www.construct.net/en/forum/construct-3/general-discussion-7/preview-launch-extremely-slow-185982

I can't reproduce this using Command & Construct which has over 8000 lines of TypeScript code - validating scripts is still very quick (<1 sec) on repeat previews. It is difficult to investigate any further without a repro.

AshleyScirra avatar May 02 '25 10:05 AshleyScirra

As this issue is inactive and not currently actionable, closing - if you can provide a repro (even just a project stuffed with dummy content) we can further investigate.

AshleyScirra avatar May 13 '25 10:05 AshleyScirra

I have noticed a delay loading "Rally Drifting" example: https://github.com/user-attachments/assets/3ed4f29d-90f6-4c45-8202-f06d32b51c36

Dramamini avatar May 13 '25 11:05 Dramamini

You should open the project and preview it twice. The first preview is likely to be slower as it needs to load and cache a lot of details (such as the Monaco editor itself, load TypeScript definitions, perform first parse of scripts etc). By the second preview it should be a lot quicker as it can skip all that.

FWIW on my system (a high end desktop) with the rally drifting example the validating scripts step appears to take less than a second, and after opening the project and previewing twice, it's so fast I can't see a progress bar that says 'Validating scripts' at all.

AshleyScirra avatar May 14 '25 10:05 AshleyScirra

My project has 64k line of scripts, it is taking 10+ seconds every single launch preview.... For what benefit? Why do Construct 3 need to check this every single time, i'm not even using the builtin script editor, and when it was CodeMirror this phase didn't exist at all, so it looks like it serves no purpose while being a massive annoyance

It makes no sense that:

  • it needs to recheck everything every time (even if only 1 or even when zero script changed)
  • it doesn't seem to be needed at all as CodeMirror which was working great didn't have that Validating script phase at all
  • it happens even for user who don't even use the built-in script editor at all

OverboyDev avatar May 15 '25 11:05 OverboyDev

Just wanted to record a quick video, the Validating Script Phase (only that part) took 43 seconds to complete....

https://github.com/user-attachments/assets/4423c65d-5502-414c-926a-6831cd95826d

OverboyDev avatar May 15 '25 12:05 OverboyDev

It shouldn't be checking everything every time - as far as I can tell Monaco is caching results and not re-checking every script every time, which is why even if the first preview is fairly slow, subsequent ones are fast. I cannot investigate further without a project that demonstrates the issue though, which is why this issue was closed, as it is not possible to do anything until then.

AshleyScirra avatar May 15 '25 14:05 AshleyScirra