GitHub user seyfe opened a pull request:

    https://github.com/apache/spark/pull/15032

    [SPARK-17480][SQL] Improve perf of gatherCompressibilityStats by removing 
List.length

    ## What changes were proposed in this pull request?
    Scala's List.length method is O(N) and it makes the 
gatherCompressibilityStats function O(N^2). Eliminate the List.length calls by 
writing it in Scala way.
    
    
https://github.com/scala/scala/blob/2.10.x/src/library/scala/collection/LinearSeqOptimized.scala#L36
    
    ## How was this patch tested?
    Profiled a Spark job and found that CompressibleColumnBuilder is using 39% 
of the CPU. Out of this 39% 
CompressibleColumnBuilder->gatherCompressibilityStats is using 23% of it. 6.24% 
of the CPU is spend on List.length which is called inside 
gatherCompressibilityStats.
    
    After this change we started to save 6.24% of the CPU.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/seyfe/spark gatherCompressibilityStats

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/15032.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15032
    
----
commit f181b92c1f3a4f91707bc1912dde29987b01c08f
Author: Ergin Seyfe <[email protected]>
Date:   2016-09-09T19:16:39Z

    Improve performance of gatherCompressibilityStats by removing List.length

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to