Skip to content

Commit 6bf54ec

Browse files
committed
update benchmark results
1 parent c82fbf3 commit 6bf54ec

File tree

1 file changed

+9
-86
lines changed

1 file changed

+9
-86
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/GenericArrayDataBenchmark.scala

Lines changed: 9 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -32,79 +32,7 @@ import org.apache.spark.util.Benchmark
3232
*/
3333
class GenericArrayDataBenchmark extends BenchmarkBase {
3434

35-
def allocateGenericIntArray(iters: Int): Unit = {
36-
val count = 1024 * 1024
37-
var array: GenericArrayData = null
38-
39-
val primitiveIntArray = new Array[Int](count)
40-
val specializedIntArray = { i: Int =>
41-
var n = 0
42-
while (n < iters) {
43-
array = new GenericArrayData(primitiveIntArray)
44-
n += 1
45-
}
46-
}
47-
val anyArray = primitiveIntArray.toArray[Any]
48-
val genericIntArray = { i: Int =>
49-
var n = 0
50-
while (n < iters) {
51-
array = new GenericArrayData(anyArray)
52-
n += 1
53-
}
54-
}
55-
56-
val benchmark = new Benchmark("Allocate GenericArrayData for int", count * iters,
57-
minNumIters = 10, minTime = 1.milliseconds)
58-
benchmark.addCase("Generic ")(genericIntArray)
59-
benchmark.addCase("Specialized")(specializedIntArray)
60-
benchmark.run
61-
/*
62-
OpenJDK 64-Bit Server VM 1.8.0_91-b14 on Linux 4.4.11-200.fc22.x86_64
63-
Intel Xeon E3-12xx v2 (Ivy Bridge)
64-
Allocate GenericArrayData for int: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
65-
------------------------------------------------------------------------------------------------
66-
Generic 0 / 0 46500044.3 0.0 1.0X
67-
Specialized 0 / 0 170500162.6 0.0 3.7X
68-
*/
69-
}
70-
71-
def allocateGenericDoubleArray(iters: Int): Unit = {
72-
val count = 1024 * 1024
73-
var array: GenericArrayData = null
74-
75-
val primitiveDoubleArray = new Array[Int](count)
76-
val specializedDoubleArray = { i: Int =>
77-
var n = 0
78-
while (n < iters) {
79-
array = new GenericArrayData(primitiveDoubleArray)
80-
n += 1
81-
}
82-
}
83-
val anyArray = primitiveDoubleArray.toArray[Any]
84-
val genericDoubleArray = { i: Int =>
85-
var n = 0
86-
while (n < iters) {
87-
array = new GenericArrayData(anyArray)
88-
n += 1
89-
}
90-
}
91-
92-
val benchmark = new Benchmark("Allocate GenericArrayData for double", count * iters,
93-
minNumIters = 10, minTime = 1.milliseconds)
94-
benchmark.addCase("Generic ")(genericDoubleArray)
95-
benchmark.addCase("Specialized")(specializedDoubleArray)
96-
benchmark.run
97-
/*
98-
OpenJDK 64-Bit Server VM 1.8.0_91-b14 on Linux 4.4.11-200.fc22.x86_64
99-
Intel Xeon E3-12xx v2 (Ivy Bridge)
100-
Allocate GenericArrayData for double: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
101-
------------------------------------------------------------------------------------------------
102-
Generic 0 / 0 55627374.0 0.0 1.0X
103-
Specialized 0 / 0 177724745.8 0.0 3.2X
104-
*/
105-
}
106-
107-
def getPrimitiveIntArray(iters: Int): Unit = {
35+
def getPrimitiveIntArray(iters: Int): Unit = {
10836
val count = 1024 * 1024 * 8
10937

11038
val anyArray: GenericArrayData = new GenericArrayData(new Array[Int](count).toArray[Any])
@@ -134,8 +62,8 @@ class GenericArrayDataBenchmark extends BenchmarkBase {
13462
Intel Xeon E3-12xx v2 (Ivy Bridge)
13563
Get int primitive array: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
13664
------------------------------------------------------------------------------------------------
137-
Generic 334 / 382 502.4 2.0 1.0X
138-
Specialized 282 / 314 595.4 1.7 1.2X
65+
Generic 277 / 366 605.0 1.7 1.0X
66+
Specialized 214 / 251 785.1 1.3 1.3X
13967
*/
14068
}
14169

@@ -169,8 +97,8 @@ class GenericArrayDataBenchmark extends BenchmarkBase {
16997
Intel Xeon E3-12xx v2 (Ivy Bridge)
17098
Get double primitive array: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
17199
------------------------------------------------------------------------------------------------
172-
Generic 1720 / 1883 97.6 10.3 1.0X
173-
Specialized 703 / 1117 238.7 4.2 2.4X
100+
Generic 1976 / 1991 84.9 11.8 1.0X
101+
Specialized 589 / 1050 285.1 3.5 3.4X
174102
*/
175103
}
176104

@@ -219,8 +147,8 @@ class GenericArrayDataBenchmark extends BenchmarkBase {
219147
Intel Xeon E3-12xx v2 (Ivy Bridge)
220148
Read GenericArrayData Int: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
221149
------------------------------------------------------------------------------------------------
222-
Generic 206 / 212 1017.6 1.0 1.0X
223-
Specialized 161 / 167 1301.0 0.8 1.3X
150+
Generic 208 / 214 1008.3 1.0 1.0X
151+
Specialized 142 / 158 1471.7 0.7 1.5X
224152
*/
225153
}
226154

@@ -269,16 +197,11 @@ class GenericArrayDataBenchmark extends BenchmarkBase {
269197
Intel Xeon E3-12xx v2 (Ivy Bridge)
270198
Read GenericArrayData Double: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative
271199
------------------------------------------------------------------------------------------------
272-
Generic 547 / 581 383.3 2.6 1.0X
273-
Specialized 237 / 260 884.0 1.1 2.3X
200+
Generic 621 / 683 337.7 3.0 1.0X
201+
Specialized 265 / 297 790.4 1.3 2.3X
274202
*/
275203
}
276204

277-
ignore("allocate GenericArrayData") {
278-
allocateGenericIntArray(20)
279-
allocateGenericDoubleArray(20)
280-
}
281-
282205
ignore("get primitive array") {
283206
getPrimitiveIntArray(20)
284207
getPrimitiveDoubleArray(20)

0 commit comments

Comments
 (0)