GitHub user jinxing64 opened a pull request: https://github.com/apache/spark/pull/16867
[SPARK-16929] Improve performance when check speculatable tasks. ## What changes were proposed in this pull request? When check speculatable tasks in `TaskSetManager`, current code scan all task infos and sort durations of successful tasks in O(NlogN) time complexity. Since during the checkin g process, `TaskSchedulerImpl`'s synchronized lock is acquired, so it might cause performance degradation when check a large scale task set, say hundreds of thousands. This change uses a `TreeSet` to cache the successful task infos and compare the median duration with running tasks, avoiding scanning all task infos. ## How was this patch tested? Existing tests. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jinxing64/spark SPARK-16929 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16867.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 #16867 ---- commit 1169d118662a9bfdabe88238352fe834a28aee14 Author: jinxing <jinx...@meituan.com> Date: 2017-02-07T02:35:10Z [SPARK-16929] Improve performance when check speculatable tasks. ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org