Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Chrome 117
Linux
Desktop
one year ago
Test name Executions per second
Multiply using Decimal.js 852.3 Ops/sec
Multiply using native numbers 2380039.5 Ops/sec
HTML Preparation code:
AخA
 
1
<script src='https://cdn.jsdelivr.net/npm/decimal.js-light@2.5.0/decimal.min.js'></script>
Script Preparation code:
 
var x = 5.236;
Tests:
  • Multiply using Decimal.js

     
    for (var i = 0; i < 1000; i++) {
      Decimal('0.00253452345').times(Decimal('0.042234'))
    }
  • Multiply using native numbers

     
    for (var i = 0; i < 1000; i++) {
      0.00253452345 * 0.042234
    }