Performance of BlockState.hashCode may be improved

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None

      When I look at a profiler's output then the BlockState.hashCode() method looks suspicious. If the profile can be trusted, it seems to consume a significant share of the server's CPU. A BlockState object has two final fields: a Class and a String object. Therefore, the hashCode() method in BlockState will always return the same value when called on the same object multiple times. Maybe caching helps?

        1. Capture_alsoCachingBlockStateEnum_hashCode.PNG
          Capture_alsoCachingBlockStateEnum_hashCode.PNG
          93 kB
        2. Capture_hashCodeCalls_new.PNG
          Capture_hashCodeCalls_new.PNG
          33 kB
        3. Capture_hashCodeCalls_old.PNG
          Capture_hashCodeCalls_old.PNG
          55 kB
        4. Capture.PNG
          Capture.PNG
          99 kB
        5. Capture.PNG
          Capture.PNG
          46 kB

            Assignee:
            Unassigned
            Reporter:
            Donald Duck
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: