Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Async alias loading

Open Efnilite opened this issue 1 year ago • 6 comments

Description

Makes alias loading async to avoid the server freezing for ~6 seconds on load. Surprisingly, changing it to loading async so far has not caused any issues.

Todo before merging

  • [x] Test with addons (will do later as I can't download SkBee right now)
  • [x] Test with example scripts

Target Minecraft Versions: any Requirements: none Related Issues: none

Efnilite avatar Sep 15 '24 19:09 Efnilite

So far has not caused any issues:

Breaks tests Edit: actually TBF I don't know if it's related or not

GStudiosX2 avatar Sep 15 '24 19:09 GStudiosX2

So far has not caused any issues:

Breaks tests Edit: actually TBF I don't know if it's related or not

they seem to be related to aliases, so its related

Asleeepp avatar Sep 15 '24 19:09 Asleeepp

So far has not caused any issues:

Breaks tests Edit: actually TBF I don't know if it's related or not

their local machine was able to load them prior to tests running, hence the local tests passed. The github machines aren't as quick.

sovdeeth avatar Sep 15 '24 19:09 sovdeeth

So far has not caused any issues:

Breaks tests Edit: actually TBF I don't know if it's related or not

blame Microsoft for poor infrastructure

Efnilite avatar Sep 15 '24 19:09 Efnilite

Call me crazy, but this isn't async.

...
[22:10:31 INFO]: [SkBee]  - 15 sections
[22:10:31 INFO]: [SkBee] Checking for update...
[22:10:32 INFO]: [SkBee] Plugin is up to date!
[22:10:32 INFO]: [SkBee] Successfully enabled v3.6.1 in 1.78 seconds
[22:10:32 INFO]: [spark] Starting background profiler...
[22:10:32 INFO]: Done preparing level "world" (5.865s)
[22:10:32 INFO]: Running delayed init tasks
-->>> ( Take note on the 4 second gap here) <<---
[22:10:36 INFO]: [Skript] Loaded 233074 aliases in 7945ms
[22:10:36 INFO]: [Skript] Loading variables...
[22:10:36 INFO]: [Skript] Loaded 0 variables in 0.0 seconds
[22:10:36 INFO]: [Skript] All scripts loaded without errors.
[22:10:36 INFO]: [Skript] Loaded 1 script with a total of 1 structure in 0.08 seconds
[22:10:36 INFO]: [Skript] Finished loading.
[22:10:36 INFO]: Done (18.045s)! For help, type "help"
[22:10:36 WARN]: Can't keep up! Is the server overloaded? Running 3631ms or 72 ticks behind
[22:10:36 INFO]: Timings Reset
> 

This appears to just delay Skript loading aliases/variables/scripts til later, causing the server to freeze after the "Running delayed init tasks" Im no master with Async but I feel like this could potentially cause issues down the road. This also doesn't appear to create any benefit.

In my opinion (I repeat... my opinion), I think rather than trying to worry about async, and "speed", should worry about cleaning up the 233074 aliases.

ShaneBeee avatar Sep 29 '24 05:09 ShaneBeee

Call me crazy, but this isn't async.

...
[22:10:31 INFO]: [SkBee]  - 15 sections
[22:10:31 INFO]: [SkBee] Checking for update...
[22:10:32 INFO]: [SkBee] Plugin is up to date!
[22:10:32 INFO]: [SkBee] Successfully enabled v3.6.1 in 1.78 seconds
[22:10:32 INFO]: [spark] Starting background profiler...
[22:10:32 INFO]: Done preparing level "world" (5.865s)
[22:10:32 INFO]: Running delayed init tasks
-->>> ( Take note on the 4 second gap here) <<---
[22:10:36 INFO]: [Skript] Loaded 233074 aliases in 7945ms
[22:10:36 INFO]: [Skript] Loading variables...
[22:10:36 INFO]: [Skript] Loaded 0 variables in 0.0 seconds
[22:10:36 INFO]: [Skript] All scripts loaded without errors.
[22:10:36 INFO]: [Skript] Loaded 1 script with a total of 1 structure in 0.08 seconds
[22:10:36 INFO]: [Skript] Finished loading.
[22:10:36 INFO]: Done (18.045s)! For help, type "help"
[22:10:36 WARN]: Can't keep up! Is the server overloaded? Running 3631ms or 72 ticks behind
[22:10:36 INFO]: Timings Reset
> 

This appears to just delay Skript loading aliases/variables/scripts til later, causing the server to freeze after the "Running delayed init tasks" Im no master with Async but I feel like this could potentially cause issues down the road. This also doesn't appear to create any benefit.

In my opinion (I repeat... my opinion), I think rather than trying to worry about async, and "speed", should worry about cleaning up the 233074 aliases.

well yeah before the scripts get parsed the aliases need to be loaded. it loads the aliases async so a seperate thread can do all the work, which does result in a ~50% speed boost. i could make it parse the scripts off the main thread as well but idk how feasible that is

Efnilite avatar Sep 29 '24 09:09 Efnilite