File tree Expand file tree Collapse file tree
core/src/test/scala/org/apache/spark/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ package org.apache.spark.io
2020import java .nio .ByteBuffer
2121
2222import com .google .common .io .ByteStreams
23-
2423import org .apache .spark .SparkFunSuite
2524import org .apache .spark .network .util .ByteArrayWritableChannel
25+ import org .apache .spark .util .Utils
2626import org .apache .spark .util .io .ChunkedByteBuffer
2727
2828class ChunkedByteBufferSuite extends SparkFunSuite {
@@ -56,23 +56,6 @@ class ChunkedByteBufferSuite extends SparkFunSuite {
5656 assert(chunkedByteBuffer.getChunks().head.position() === 0 )
5757 }
5858
59- test(" benchmark" ) {
60- val buffer100 = ByteBuffer .allocate(1024 * 1024 * 100 )
61- val buffer30 = ByteBuffer .allocate(1024 * 1024 * 30 )
62- val chunkedByteBuffer = new ChunkedByteBuffer (Array .fill(5 )(buffer100))
63- var starTime = System .currentTimeMillis()
64- for (i <- 1 to 10 ) {
65- chunkedByteBuffer.writeFully(new ByteArrayWritableChannel (chunkedByteBuffer.size.toInt))
66- }
67- // scalastyle:off
68- System .out.println(System .currentTimeMillis() - starTime)
69- starTime = System .currentTimeMillis()
70- for (i <- 1 to 10 ) {
71- chunkedByteBuffer.writeWithSlice(new ByteArrayWritableChannel (chunkedByteBuffer.size.toInt))
72- }
73- System .out.println(System .currentTimeMillis() - starTime)
74- }
75-
7659 test(" toArray()" ) {
7760 val empty = ByteBuffer .wrap(Array .empty[Byte ])
7861 val bytes = ByteBuffer .wrap(Array .tabulate(8 )(_.toByte))
You can’t perform that action at this time.
0 commit comments