@ExperimentalBlackHoleApi
object BlackHole


Function calls which can be used to prevent optimization of results.

Both the Kotlin compiler and R8 can remove code you intend to benchmark. To prevent this, pass the result to BlackHole.consume.

Summary

Public functions

external Unit
consume(value: Any)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Boolean)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Byte)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Char)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Double)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Float)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Int)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Long)

Prevent dead code elimination of value and its computation.

external Unit
consume(value: Short)

Prevent dead code elimination of value and its computation.

Public functions

consume

Added in 1.3.0
external fun consume(value: Any): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Boolean): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Byte): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Char): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Double): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Float): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Int): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Long): Unit

Prevent dead code elimination of value and its computation.

consume

Added in 1.3.0
external fun consume(value: Short): Unit

Prevent dead code elimination of value and its computation.