Script Parse now is much much slower

Previously, like a month ago, script parse took less than a couple of seconds. Now, every time I click parse or create a new script, I need to wait like tripple that time. Creating a new script is most frustrating. Every time is like:

  1. Create a new entity
  2. Add script component
  3. Type a new script name, press enter
  4. Oh my script file appeared
  5. Nothing happens
  6. Oh I see “script {name} parsing” message
  7. Still parsing?
  8. Casually switch to script asset to see is it really parsing
  9. Yep, it’s parsed
  10. Switch back to entity
  11. Now I can add attributes to my script, and wait that parsing again and again

Previously this parsing took like fraction of a second. Script asset appeared after creation, and in a blink of an eye it was already parsed inside my entity.

@Mark_Lundin to investgiate

Hey @OlegsGedzjuns, just looking into this but struggling to replicate from your steps. Here’s what I’m doing:

  1. Create New Entity
  2. Add a script component
  3. Click “+ Create Script” in the component
  4. Add a name ‘test’
  5. Verify script is attached
  6. Click the parse button

This seems to work for me, pretty quickly too, but I’m guessing it’s more intermittent for you. One thing I did find - sometimes editing code adding/removing attribute doesn’t seem to persist. So when you parse it’s stale data which requires a refresh. Wondering if that’s similar to what you’re seeing

For whatever reason script parsing is quite weird at times

2 Likes

Any details on ‘weird’?

I often have to reload the editor after parsing to make updates visible in the inspector.

1 Like

In small fresh project parse is fast, on the old bigger one parse can take up to 10 seconds.
And yes, stale data happens for me too. Also just created a new ticked about template highlights Highlighted template changes disappear after script parse is pressed · Issue #1450 · playcanvas/editor · GitHub

I think it’s pretty much the same as Mark and Albertos said. Sometimes changes do not appear at all

Yep, I’m trying to pinpoint exactly what’s going on, but it seems to be inconsistent and hard to replicate. If anyone has some easily reproducible steps, or a video, it would really help. In the mean time I’ll continue to investigate.

2 Likes

For me it’s always:

  1. Lock my pc
  2. Go to the lunch break
  3. Return after 30-50 minutes
  4. Unlock my PC
  5. “God damn, this scripts are not parsed again”

Feel free to use this plan

:laughing: I will do this. Hopefully it wont be different because it’s dinner

1 Like

Sometimes scripts just refuse to parse, I might have had scripts stuck parsing for an hour before, I dont really remember. Also sometimes when I add an attribute it refuses to show up until I reload the page.

Yeah this seems consistent with the behaviour I’m seeing. The updated script doesn’t save correctly, so when you parse it fails to pick up new attributes. I’ll keep looking into this today

I think I’ve isolated one of the problems and have submitted a fix Fixes WebSocket connection handling by marklundin · Pull Request #1452 · playcanvas/editor · GitHub. I’ll continue investigating incase theres something else

2 Likes

happy to hear that

@OlegsGedzjuns We’ve pushed a fix for editor disconnects which should have helped with some of these issues. Just curious if you’re seeing any other stability issues related to this. I know they’re often difficult to replicate, but I’m keen to iron out any other issues.

@Mark_Lundin One more issue that is frustrating enough.
Sometimes in code editor, when opening a script, only empty file appears.


And in the console, this two warnings

Sometimes, close/open same file helps, sometimes I need to reload tab for file to work

1 Like

Yep I have seen this before. Not sure of the repro steps though. I will take a look though