[ https://issues.apache.org/jira/browse/CALCITE-4577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17325474#comment-17325474 ]
Haisheng Yuan commented on CALCITE-4577: ---------------------------------------- See comments in CALCITE-4578, since 1.24.0, the issue should exist anymore. > RelDigestWriter#done has performance issue when node's inputs is large > ---------------------------------------------------------------------- > > Key: CALCITE-4577 > URL: https://issues.apache.org/jira/browse/CALCITE-4577 > Project: Calcite > Issue Type: Bug > Components: core > Reporter: Jiatao Tao > Assignee: Jiatao Tao > Priority: Critical > Attachments: image-2021-04-11-16-53-35-466.png, > image-2021-04-11-16-53-58-757.png > > > Example like that: insert xxx VALUES (1, 'one'), (2, 'two'), (3, > 'three')...(10000, 'ten thousand'); > It generates a Union node with 10000 inputs, and the performance is poor, > here's the profile: > > !image-2021-04-11-16-53-58-757.png|width=735,height=109! > A point that affects performance is the array copy of StringBuilder, current > we just new StringBuilder with default capacity, my proposal is to consider > the node's input size, like that(we can discuss the strategy): > org.apache.calcite.rel.AbstractRelNode.RelDigestWriter#done > {code:java} > StringBuilder sb = new StringBuilder((values.size() + 1) * 16);{code} > It's about 20% performance improvement and mem is more smooth. > -- This message was sent by Atlassian Jira (v8.3.4#803005)