Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Algol68
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C with Coccinelle
C++ with Coccinelle
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Mojo
Nim
Numba
Nix
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
PTX
Python
Racket
Raku
Ruby
Rust
Sail
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
Triton
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Zig
Javascript
GIMPLE
Ygen
sway
kotlin source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
kotlinc 1.4.0
kotlinc 1.4.10
kotlinc 1.4.20
kotlinc 1.4.21
kotlinc 1.4.30
kotlinc 1.4.31
kotlinc 1.4.32
kotlinc 1.5.0
kotlinc 1.5.10
kotlinc 1.5.20
kotlinc 1.5.21
kotlinc 1.5.30
kotlinc 1.5.31
kotlinc 1.6.0
kotlinc 1.6.10
kotlinc 1.6.20
kotlinc 1.7.0
kotlinc 1.8.0
kotlinc 1.8.10
kotlinc 1.8.20
kotlinc 1.9.0
kotlinc 1.9.10
kotlinc 1.9.20
kotlinc 2.0.0
kotlinc 2.0.10
kotlinc 2.0.20
kotlinc 2.0.21
kotlinc 2.1.0
kotlinc 2.1.10
kotlinc 2.1.20
kotlinc 2.1.21
kotlinc 2.2.0
kotlinc 2.2.10
Options
Source code
import kotlin.random.Random fun main(args: Array<String>) { val u: Int = args.get(0).toInt() val r: Int = Random.nextInt(10_000) val a = IntArray(10_000) for (i in 0 until 10_000) { for (j in 0 until 100_000) { a[i] = a[i] + j % u } a[i] = a[i] + r } println(a[r]) }
java source #2
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
jdk 10.0.2
jdk 11.0.2
jdk 12.0.1
jdk 12.0.2
jdk 13.0.2
jdk 14.0.2
jdk 15.0.2
jdk 16.0.1
jdk 17.0.0
jdk 17.0.2
jdk 18.0.0
jdk 18.0.2
jdk 19.0.2
jdk 20.0.0
jdk 20.0.2
jdk 21.0.0
jdk 21.0.2
jdk 22.0.0
jdk 22.0.2
jdk 23.0.1
jdk 24.0.0
jdk 8.402.6
jdk 9.0.4
Options
Source code
package jvm; import java.util.Random; class code { public static void main(String[] args) { var u = Integer.parseInt(args[0]); // Get an input number from the command line var r = new Random().nextInt(10000); // Get a random number 0 <= r < 10k var a = new int[10000]; // Array of 10k elements initialized to 0 for (var i = 0; i < 10000; i++) { // 10k outer loop iterations for (var j = 0; j < 100000; j++) { // 100k inner loop iterations, per outer loop iteration a[i] = a[i] + j % u; // Simple sum } a[i] += r; // Add a random value to each element in array } System.out.println(a[r]); // Print out a single element from the array } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree