Create Fabric

Create Fabric

7M Downloads

Performance issue with Smart Blocks

spectrapulse opened this issue ยท 3 comments

commented

Describe the Bug

Smart Blocks such as the Smart Chute or the Brass Funnel seem to be performing horribly when a filter is set. (They also perform pretty badly without but it's especially bad with a filter) When adding a Smart Block to a block with an inventory such as a Item Vault or even a chest and setting a simple single block filter or even worse a regular or an attribute filter. A single instance of said block can add (according to my testing) up to 6ms to the MSPT by itself when the inventory connected to it is large enough.

Reproduction Steps

  1. Create a new Minecraft Instance containing Observable and Spark alongside Create (no other mods, not even performance mods)
  2. Create a new world (I've made a simple void preset world to minimize variables)
  3. Create a large item vault and fill it with a random block type.
  4. Add a smart block to it containing a any kind of filter that doesn't match what is in the item vault.
  5. Run the profiler/observable to find impact on the game performance. (I used to observable in the screenshot so performance impact per block is more visible)

Expected Result

Smart Blocks with filter's shouldn't have as much impact on MSPT as they do now.

Screenshots and Videos

2023-12-10_00 04 06
2023-12-10_00 04 58

Observable results in the browser after profile:
image
Spark profiling results in browser with relevant nodes expanded:
2023-12-10 00 23 00 spark lucko me f165f19c8deb

Crash Report or Log

N/A

Operating System

Windows 11

Mod Version

0.5.1d

Minecraft Version

1.20.1

Other Mods

There was no crash but the mods that I used in the instance where I tested and reproduced my own issue had these mods installed even though I don't think they're relevant:

Spark, Observable, EMI, Extra Mod Integrations (EMI Addon), Jade, Jade Addons and Architectury.

Additional Context

I'm hosting a private server with a custom, private but create focused modpack and I noticed how lag started becoming more prevalent with people creating their first few advanced-ish contraptions so I went diagnosing where the lag came from and found that the source of the lag was because of these blocks.

I don't expect Create to be the most performant mod but I think 6ms for a single block is kind of wild and usually indicates an issue with the code.

I've not made this issue upstream because it currently looks like most of the slow-downs are related to how the logic by smart blocks are being handled in PortingLib from my minimal knowledge of Java and the codebase.

I've not tested if the behavior is the same in the Forge version so I'm not sure if this issue also exists upstream and I honestly haven't checked.

This may be a duplicate of #1158 but seeing how that issue has been formatted it may not be very helpful in it's current form so maybe that can be closed and replaced by this one?

commented

This should be fixed by Create Patch F (unreleased on fabric at the time of speaking), in the event this still happens and its only on fabic and doesnt occur on forge please open a new issue. (And if it happens on forge then report to the forge repo)

commented

If you can, use single-item filters on funnels; that decreases the load on those. For chutes, I have yet to find a good workaround. They seem to be okay while they can transfer items, but once the target is full, they start lagging. Even Redstone locking appears to not do anything with that.

commented

If you can, use single-item filters on funnels; that decreases the load on those. For chutes, I have yet to find a good workaround. They seem to be okay while they can transfer items, but once the target is full, they start lagging. Even Redstone locking appears to not do anything with that.

Yeah I've already temporarily worked around that for my own contraptions and compensated players for changing theirs. But if this isn't looked into, this will not scale well in the long term since smart blocks are a rather core part of many contraptions.