title: 'Substring' or 'if with length & min' - significant better performance
body: <p>Which piece of code has better performance?</p>
  
  <pre><code>Pseudocode:
  1)
  prvate String doSth(String s) {
  ...
   return s.substring(0, Math.min(s.length(), constparam));
  }
  
  2)
  prvate String doSth(String s) {
   if (s.length() &gt; constparam) {
    return s.substring(0, constparam);
   }
   return s;
  }
  </code></pre>
  
  <p>In most cases (99%) - s.length &lt; constparam.
  This method is invoked 20-200 times per second.
  Which solution (and why) would have a better performance?
  Will it be a significant impact?</p>