
 HttpURLConnection’s Dark Secrets - wglb
http://www.tbray.org/ongoing/When/201x/2012/01/17/HttpURLConnection
======
jmitcheson
Interesting snippet from article to test if http response code is between 200
and 299 "http_status / 100 != 2". Never seen that before..

~~~
chadaustin
Compares and jumps are cheap only if the branch is predicted. If not
predicted, they're worse than a division. In data-driven conditionals, a
conditional move operations is likely the best.

~~~
zokier
There is still a compare/jump with the division method ( != 0) which needs
prediction.

------
fleitz
Oh java, how I miss your state machine objects with strange initialization
patterns.

Only in Java would it make sense that you need to call getInputStream before
you can check a result code.

I wonder what would happen if one called getInputStream twice.

    
    
      Coding inJavaMakesMeWantTo() throws up {
         throw new up("The punctuation I ate for breakfast on to the screen");
      };

