Does trying-catch block placement affect performance?
EXAMPLE 1: try-catch block inside a while loop
while (true) { try { // ... read from a file } catch (EOFException e) { break; } }
EXAMPLE 2: a try-catch block surrounds a while loop
try { while (true) { // ... read from a file } } catch (EOFException e) { // :P }
Logically, these two examples are equivalent, but what should I prefer?
java performance try-catch
Mr. White
source share