title: What to do with Java BigDecimal performance?
body: <p>I write currency trading applications for living, so I have to work with monetary values (it's a shame that Java still doesn't have decimal float type and has nothing to support arbitrary-precision monetary calculations). "Use BigDecimal!" — you might say. I do. But now I have some code where performance <strong>is</strong> an issue, and BigDecimal is more than 1000 times (!) slower than <code>double</code> primitives.</p>
  
  <p>The calculations are very simple: what the system does is calculating <code>a = (1/b) * c</code> many many times (where <code>a</code>, <code>b</code> and <code>c</code> are fixed-point values). The problem, however, lies with this <code>(1/b)</code>. I can't use fixed point arithmetic because there is no fixed point. And <code>BigDecimal result = a.multiply(BigDecimal.ONE.divide(b).multiply(c)</code> is not only ugly, but sluggishly slow.</p>
  
  <p>What can I use to replace BigDecimal? I need at least 10x performance increase. I found otherwise excellent <a href="http://www.jscience.org" rel="noreferrer" title="JScience">JScience library</a> which has arbitrary-precision arithmetics, but it's even slower than BigDecimal.</p>
  
  <p>Any suggestions?</p>