Created
June 6, 2024 12:24
-
-
Save TheLivan/5cdb9c0467bda31689d3a5810cf47388 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Main { | |
public static void main(String[] args) { | |
long t0, t1, t2, t3; | |
t0 = System.currentTimeMillis(); | |
boolean a = false, b = false, c = true; | |
for (int i = 0; i < 700000; i++) { | |
if (a || b || c) { System.currentTimeMillis(); } | |
} | |
t1 = System.currentTimeMillis(); | |
t2 = System.currentTimeMillis(); | |
for (int i = 0; i < 700000; i++) { | |
if (a | b | c) { System.currentTimeMillis(); } | |
} | |
t3 = System.currentTimeMillis(); | |
System.out.println("a || b || c : " + (t1 - t0) + " ms"); | |
System.out.println("a | b | c : " + (t3 - t2) + " ms" + " (" + ((float) (t3 - t2) / (t1 - t0)) + ")"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment