Parenting instances that contain a ModuleScript to workspace is extremely expensive

- Detailed description of bug;
When an instance has a ModuleScript descendant, parenting it to workspace takes around 10x longer than if the ModuleScript was not there. This occurs seemingly regardless of if the ModuleScript source was large.

- Where the bug happens (be specific);
Roblox studio Run mode

- Steps to reproduce the issue (be minimal, specific, consistent!);
Create an instance with a ModuleScript child, and put said instance in ReplicatedStorage. Next, parent the instance to workspace. Comparing overall performance, it is significantly slower to parent with a ModuleScript descendant.

1 Like

You should probably include more information, such as a file that reproduces and demonstrates the problem (how are you benchmarking this, and are you doing it the client or the server).

2 Likes

Have you performed tests with any other instances to see if effects vary?

Can you please show us the output from this file?
Baseplate.rbxl (18.4 KB)
Be aware though: you’ll need to wait for ~10 seconds for the result to show up.
For me, it’s not 10x slower:
image
I’m on version 432, maybe it differs from the latest one.

I noticed something really really interesting with your test…

It’s actually quicker if you require the module first, then parent it.

I was curious because I wondered if OP’s issue was that the module had been required and somehow took longer as a result to move it due to some internal stuff. But I tried a good 10 times both with and without requiring the module first, and nearly every time it was faster to require() it. Once it was faster even without requiring first.

Either way, I am on version 443 and see similar results of the differences being around 10% faster if you require the module first and around 5% slower if not required first.

Certainly nowhere near the 1000% claimed by OP and definitely not “extreme”.

1 Like

It could be due to a plugin that listens to the workspace.

1 Like

I am in the process of checking over bug reports and following up on some bugs that haven’t received any activity in a while.
Is this issue still occurring or can you confirm that this bug has been resolved?

This issue has been resolved - the root cause was a plugin listening for updates.

Thanks!