You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by eatoncys <gi...@git.apache.org> on 2017/06/08 09:11:48 UTC
[GitHub] spark pull request #18240: [SPARK-21017][sql]Move the length getter before t...
GitHub user eatoncys opened a pull request:
https://github.com/apache/spark/pull/18240
[SPARK-21017][sql]Move the length getter before the while to improve performance
## What changes were proposed in this pull request?
In my test, the cost of the while in the write function of HiveOutputWriter class have improved from 48ms to 40ms for a table of 500 rows and 100 columns when putting the length getter before the while
## How was this patch tested?
Run the UT test
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/eatoncys/spark length
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18240.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 #18240
----
commit bcb3ffa26fe14ac0702f091e11e9c682261fc81f
Author: 10129659 <ch...@zte.com.cn>
Date: 2017-06-08T08:52:09Z
Move the length getter before the while to improve performance
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #18240: [SPARK-21017][sql]Move the length getter before t...
Posted by eatoncys <gi...@git.apache.org>.
Github user eatoncys closed the pull request at:
https://github.com/apache/spark/pull/18240
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #18240: [SPARK-21017][sql]Move the length getter before the whil...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/18240
Can one of the admins verify this patch?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #18240: [SPARK-21017][sql]Move the length getter before t...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/18240#discussion_r120837951
--- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveFileFormat.scala ---
@@ -142,7 +142,8 @@ class HiveOutputWriter(
override def write(row: InternalRow): Unit = {
var i = 0
- while (i < fieldOIs.length) {
+ val fieldOIsLength = fieldOIs.length
+ while (i < fieldOIsLength) {
--- End diff --
`fieldOIs` is an array, and accessing its length should be as fast as accessing any local variable. I can't imagine it's making this much difference compared to all the other operations here. Are you sure?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #18240: [SPARK-21017][sql]Move the length getter before t...
Posted by eatoncys <gi...@git.apache.org>.
Github user eatoncys commented on a diff in the pull request:
https://github.com/apache/spark/pull/18240#discussion_r120840468
--- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveFileFormat.scala ---
@@ -142,7 +142,8 @@ class HiveOutputWriter(
override def write(row: InternalRow): Unit = {
var i = 0
- while (i < fieldOIs.length) {
+ val fieldOIsLength = fieldOIs.length
+ while (i < fieldOIsLength) {
--- End diff --
I have tried the test 10 times , and the average cost is almost same, I will close the PR, thanks!
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org