Josh Rosen created SPARK-15742:
----------------------------------

             Summary: Reduce collections allocations in Catalyst tree 
transformation methods
                 Key: SPARK-15742
                 URL: https://issues.apache.org/jira/browse/SPARK-15742
             Project: Spark
          Issue Type: Improvement
          Components: SQL
            Reporter: Josh Rosen
            Assignee: Josh Rosen


In Catalyst's TreeNode {{transform}} methods we end up calling 
{{productIterator.map(...).toArray()}} in a number of places, which is slightly 
inefficient because it needs to allocate and grow ArrayBuilders. Since we 
already know the size of the final output ({{productArity}}), we can simply 
allocate an array up-front and use a while loop to consume the iterator and 
populate the array.

For most workloads, this performance difference is negligible but it does make 
a measurable difference in optimizer performance for queries that operate over 
very wide schemas (thousands of columns).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to