Is there any performance difference between catching Exception or certain type exception ? - Java
<p>I wonder whether can be a difference or performance issues between those 2 blocks:</p>

<pre><code>    try{
        return Integer.parseInt(numAsString);
    }catch (Exception e){
        return onErrorInt;
    }
</code></pre>

<p>and </p>

<pre><code>    try{
        return Integer.parseInt(numAsString);
    }catch (NumberFormatException e){
        return onErrorInt;
    }
</code></pre>

<p>Sometimes there is even inside the try many kind of exceptions like:</p>

<pre><code>    try{
        // open file then try to close
        // try to parse integer
        // another kind of exception throwing funcitons
    }catch (Exception e){
        return onErrorInt;
    }
</code></pre>

<p>and</p>

<pre><code>    try{
        // open file then try to close
        // try to parse integer
        // another kind of exception throwing funcitons
    }catch (NumberFormatException e){
        return // something;
    } catch (IOException e){
        // return same thing in the exception above
    }
</code></pre>

<p>.</p>

<p>What i am doing is System that will stay running 24 hours a day with 1 restart per day. </p>

<p>In many places i dont care about the type of the Exception, i just need to let my app running all the time. So mainly my question about <strong>performance</strong>.</p>