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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.22.0
    • 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

              Unassigned Unassigned
              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