Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3785

Performance regression in HepPlanner#belongsToDag() due to expensive hashCode computation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: None

      Description

      It turns out that the change in CALCITE-3713 added an extra overhead of 20~30% HepPlanner. The hash map lookup in belongsToDag becomes much slower due to expensive computation of the hashcode and equals for the list.

      A simple profiling of the planner before and after CALCITE-3713 is shown below.

      To test whether or not a vertex belongs to DAG, we can simply do graph.vertexSet().contains(vertex); There's no need to look up in mapDigestToVertex map, which incurs overhead of creating the map key. This problem was amplified by CALCITE-3713.

        Attachments

        1. before.png
          16 kB
          Stamatis Zampetakis
        2. after.png
          35 kB
          Stamatis Zampetakis

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                xndai Xiening Dai
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m