openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

Lag Introduced from Disabled Plugin #388

Closed smalljustin closed 8 months ago

smalljustin commented 1 year ago

If you put this plugin in your plugins folder, you'll get awful performance issues faslely attributed to other plugins, even if it's disabled.

In the video, I start with the plugin in my plugins folder, demonstrate the issue, then remove it and restart the script engine (and the issue is gone)

(video on discord #troubleshooting channel, Oct 23 GMT)

https://github.com/smalljustin/testing-yield

codecat commented 1 year ago

Thanks, I'll take a look.

Is there anything specific you have found about this that could be doing it? I see a lot of code there and wondering if it's possible to have a smaller reproduce case.

smalljustin commented 1 year ago

Sure - here's the code. Commenting out 'ManyRunnables rootRunnable();' resolves the issue.


void Main() {
}

ManyRunnables rootRunnable();

class FibObj {
}

class ManyRunnables {
    array<SmallestRunnable@> innerRunnableArray(100000000);
    ManyRunnables() {}
}

class SmallestRunnable {
    FibObj @fibOjbRunnable; 
    int p1, p2;
    SmallestRunnable() {} 
}
codecat commented 1 year ago

Ah, you are allocating a lot of memory; this would indeed slow down everything a lot. I'm not sure this is necessarily a bug, since allocations will legitimately slow down other plugins a lot.

smalljustin commented 1 year ago

Found something interesting - this only happens with an array of object handles. If it's a string array instead, the issue is gone.

I'm pretty sure this wasn't an issue in the patch I originally wrote this code in, but I don't remember for sure - at any rate, it's a pretty theoretical issue.

void Main() {
}

ManyRunnables rootRunnable();

class ManyRunnables {
    array<SmallestRunnable@> innerRunnableArrayObj(100000000);
    array<string> innerRunnableArrayStr(100000000);
    ManyRunnables() {}
}

class SmallestRunnable {
    SmallestRunnable() {} 
}
codecat commented 8 months ago

I'll classify this as a non-issue for now. Feel free to re-open this issue if you run into this in a practical scenario.