Advertisement
gurumutant

Kotlin Simple Nested Loop Benchmarking

May 26th, 2022
588
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import kotlin.system.measureTimeMillis
  2.  
  3. fun main() {
  4.     val time = measureTimeMillis {
  5.         var n: Int = 0;
  6.         val rangeY = 1.rangeTo(100000)
  7.         for (y in rangeY) {
  8.             val rangeX = 1.rangeTo(80)
  9.             for (x in rangeX)
  10.                 print("${++n}\t")
  11.             println()
  12.         }
  13.     }
  14.     println("Eksekusi selesai dalam $time ms")
  15. }
Advertisement
RAW Paste Data Copied
Advertisement