Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19937#discussion_r155949301
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala
---
@@ -617,6 +619,7 @@ case class SortMergeJoinExec(
s"""
|while (findNextInnerJoinRows($leftInput, $rightInput)) {
+ | ${leftVarDecl.mkString("\n")}
--- End diff --
Here is my benchmark result. Is there any your result?
```
$ cat Loop.java
public class Loop {
private static int _i;
private static boolean _b;
public static void main(String[] args){
Loop l = new Loop();
long s, e;
long c1 = 10000000000L;
long c2 = 100000L;
int N = 10;
// warmup
for (int i = 0; i < 1000000; i++) {
l.inner(10000, 100);
l.outer(10000, 100);
}
for (int n = 0; n < N; n++) {
s = System.nanoTime();
l.inner(c1, c2);
e = System.nanoTime();
System.out.println("inner(ms): " + (e-s) / 1000000);
}
for (int n = 0; n < N; n++) {
s = System.nanoTime();
l.outer(c1, c2);
e = System.nanoTime();
System.out.println("outer(ms): " + (e-s) / 1000000);
}
}
public void inner(long c1, long c2) {
for (long i = 0; i < c1; i++) {
int v1 = 1;
boolean v2 = true;
for (long j = 0; i < c2; i++) {
_i = v1;
_b = v2;
}
}
}
public void outer(long c1, long c2) {
int v1 = 1;
boolean v2 = true;
for (long i = 0; i < c1; i++) {
for (long j = 0; i < c2; i++) {
_i = v1;
_b = v2;
}
}
}
}
$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
$ java Loop
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
inner(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
outer(ms): 2779
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]