title: How 'heavy' are the following statements?
body: <p>So lately I've been trying to figure out how 'heavy' some statements are.
  For example is it a good thing to check for every possible exception with if statements or will that slow down the programm considerably? So I bassically want to know how 'heavy' the folling statements get when used a lot. This is mostly just a question out of curiosity because today's computer are so fast that it probably doesn't matter But it will also help me choose between different ways of doing things though perfomance improvements might only be minimal.</p>
  
  <p>A simple while loop how 'heavy' is the loop itself not the code inside it?</p>
  
  <pre><code>while(true){}
  </code></pre>
  
  <p>A for loop probably smiliar to the while loop?</p>
  
  <pre><code>for(int i = 0; true; i++){}
  </code></pre>
  
  <p>A do while loop probably smiliar to the above two too?</p>
  
  <pre><code>do{...}while(true)
  </code></pre>
  
  <p>An if statement how 'heavy' does this get?</p>
  
  <pre><code>if(true){}
  </code></pre>
  
  <p>A switch statement</p>
  
  <pre><code>switch(0){
     case 0:
  }
  </code></pre>
  
  <p>And is a switch statement less 'heavy' or 'heavier' than <code>else if</code> statements</p>
  
  <p>And the instanceof check how 'heavy' is it?</p>
  
  <pre><code>if(obj instanceof Player){}
  </code></pre>
  
  <p>An is <code>null</code> check I heard that this one is really 'light' is that true?</p>
  
  <pre><code>if(obj == null){}
  </code></pre>
  
  <p>And a constructor call</p>
  
  <pre><code>new Object();
  </code></pre>
  
  <p>And a method call</p>
  
  <pre><code>MyClass.doSomething();
  </code></pre>
  
  <p>A variable assignment</p>
  
  <pre><code>int i = 10;
  </code></pre>
  
  <p>I tried searching on the internet but I didn't find a web page that was comparing them all to each other or something smiliar. But if some of you have a good documentation on this I would be more than happy to read it.</p>