Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-136154

Optimize the hopper full check function Hopper::_isFullContainer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.17.10
    • None
    • Unconfirmed
    • Windows

      Hello, I'm a community developer, and I recently did some tests when I was studying the problem of too high MSPT occupancy of the hopper. I used the hook function method to test the execution time of  some hopper-related functions.

      After observing the test results, I annotated a function called Hopper::_isFullContainer,In most static case(non item pull in or out), the main run time of hopper tick is on this function.

      I know that your intention is to determine the hopper situation in advance, so as to reduce the execution of some codes. But unfortunately, your optimization did not have a very good effect due to the low execution efficiency of this function. When dealing with items with nbt, this mspt occupancy is more obvious.

      So I hope you can try to optimize the code of this function to improve its execution efficiency. 

      Here are some of my test results:

       

      conditions hopper tick time(ms) full check time(ms)
      empy hopper 0.013 0.0
      full hopper (5 full shulker box,same below) 0.884 0.872
      full hopper points to full chest 5.289 5.287

       

      ()

            hhhxiao hhhxiao
            Votes:
            20 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: