You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Haisheng Yuan (Jira)" <ji...@apache.org> on 2020/02/13 00:27:00 UTC

[jira] [Resolved] (CALCITE-3785) Performance regression in HepPlanner#belongsToDag() due to expensive hashCode computation

     [ https://issues.apache.org/jira/browse/CALCITE-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haisheng Yuan resolved CALCITE-3785.
------------------------------------
    Fix Version/s: 1.22.0
       Resolution: Fixed

Fixed in https://github.com/apache/calcite/commit/a09923ff8dcb707c5573b37e182308f90dfb52fe.

> Performance regression in HepPlanner#belongsToDag() due to expensive hashCode computation
> -----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3785
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3785
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Xiening Dai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>         Attachments: after.png, before.png
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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.
>  !before.png! 
>  !after.png! 
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)