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