Skip to content

Instantly share code, notes, and snippets.

@TheLivan
Created June 6, 2024 12:24
Show Gist options
  • Save TheLivan/5cdb9c0467bda31689d3a5810cf47388 to your computer and use it in GitHub Desktop.
Save TheLivan/5cdb9c0467bda31689d3a5810cf47388 to your computer and use it in GitHub Desktop.
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