Skip to content

Commit

Permalink
tiny cleanup on NonblockingParserComparisonBenchmark
Browse files Browse the repository at this point in the history
Signed-off-by: Laszlo Hornyak <[email protected]>
  • Loading branch information
K0zka committed Jan 5, 2024
1 parent fdab9c2 commit e4e94fe
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.TearDown
import org.openjdk.jmh.infra.Blackhole
import java.io.File
import java.io.RandomAccessFile
import java.nio.ByteBuffer
import java.util.*

Expand All @@ -21,7 +22,7 @@ open class NonblockingParserComparisonBenchmark {
var size : Int = 1
private val objectMapper = ObjectMapper()

lateinit var testFile : File
private lateinit var testFile : File

@Setup
fun setup() {
Expand Down Expand Up @@ -54,7 +55,7 @@ open class NonblockingParserComparisonBenchmark {
ObjectMapper().createNonBlockingByteArrayParser().use {
parser ->
parser as NonBlockingJsonParser
testFile.inputStream().channel.use {
RandomAccessFile(testFile.absoluteFile, "r").channel.use {
channel ->
while (channel.position() < channel.size()) {
val bufferSize = channel.read(byteBuffer)
Expand Down

0 comments on commit e4e94fe

Please sign in to comment.