sunchao commented on a change in pull request #32407:
URL: https://github.com/apache/spark/pull/32407#discussion_r624110505
##########
File path: sql/core/benchmarks/FunctionBenchmark-jdk11-results.txt
##########
@@ -0,0 +1,32 @@
+OpenJDK 64-Bit Server VM 11.0.10+9-LTS on Mac OS X 10.16
+Intel(R) Core(TM) i9-10910 CPU @ 3.60GHz
+scalar function (long + long) -> long/notnull wholestage on: Best Time(ms)
Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative
+-------------------------------------------------------------------------------------------------------------------------------------------
+with long_add_default 27292
29059 1913 18.3 54.6 1.0X
+with long_add_magic 7049
7070 20 70.9 14.1 3.9X
+with long_add_static_magic 6752
6791 67 74.1 13.5 4.0X
+
+OpenJDK 64-Bit Server VM 11.0.10+9-LTS on Mac OS X 10.16
+Intel(R) Core(TM) i9-10910 CPU @ 3.60GHz
+scalar function (long + long) -> long/notnull wholestage off: Best Time(ms)
Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative
+--------------------------------------------------------------------------------------------------------------------------------------------
+with long_add_default 28601
28964 496 17.5 57.2 1.0X
+with long_add_magic 6986
7156 150 71.6 14.0 4.1X
+with long_add_static_magic 6509
6539 32 76.8 13.0 4.4X
Review comment:
Yes very good point! I'm puzzled by this result too. There are some
interesting stuff in the result:
1. why the magic method approach is so much faster than the `produceResult`
approach: we didn't see that much difference in @cloud-fan 's
[benchmark](https://gist.github.com/cloud-fan/f88baf770fa0c6f9ad312e8c92ff6c21).
2. why codegen on/off doesn't affect the result much
3. why we don't see Java outperform Scala when using the static magic method
approach (since it uses `invokestatic`). I did some benchmark with Java UDFs
but didn't include the result in this PR.
Let me do some profiling to find out why. Will update later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]