Skip to content
Sandeep Singh edited this page Mar 6, 2014 · 2 revisions

Multiplication

  • Scala 2.10.3 JDK 7
[info] length  benchmark        us linear runtime
[info]     32     BigInt      1.23 =
[info]     32    BigInt2      1.35 =
[info]     32 BigInteger      1.05 =
[info]     32      Apint     13.04 =
[info]     64     BigInt      3.46 =
[info]     64    BigInt2      5.00 =
[info]     64 BigInteger      3.43 =
[info]     64      Apint     35.37 =
[info]    200     BigInt     31.48 =
[info]    200    BigInt2     39.06 =
[info]    200 BigInteger     31.69 =
[info]    200      Apint    644.17 =
[info]    500     BigInt    192.10 =
[info]    500    BigInt2    173.91 =
[info]    500 BigInteger    184.24 =
[info]    500      Apint   3300.95 =
[info]   1000     BigInt    729.55 =
[info]   1000    BigInt2    486.56 =
[info]   1000 BigInteger    717.77 =
[info]   1000      Apint   6394.53 =
[info]   5000     BigInt  18064.78 =
[info]   5000    BigInt2   6396.70 =
[info]   5000 BigInteger  19362.90 =
[info]   5000      Apint  38194.06 ===
[info]  10000     BigInt  75302.22 ======
[info]  10000    BigInt2  17871.33 =
[info]  10000 BigInteger  80761.71 =======
[info]  10000      Apint  81227.83 =======
[info]  20000     BigInt 325685.84 ==============================
[info]  20000    BigInt2  52720.18 ====
[info]  20000 BigInteger 320728.53 =============================
[info]  20000      Apint  98764.42 =========
  • Scala 2.10.3 JDK 8
[info] length  benchmark        us linear runtime
[info]     32     BigInt      1.40 =
[info]     32    BigInt2      1.35 =
[info]     32 BigInteger      1.24 =
[info]     32      Apint     13.15 =
[info]     64     BigInt      4.53 =
[info]     64    BigInt2      5.05 =
[info]     64 BigInteger      4.28 =
[info]     64      Apint     35.32 =
[info]    200     BigInt     31.44 =
[info]    200    BigInt2     40.12 =
[info]    200 BigInteger     31.97 =
[info]    200      Apint    664.08 =
[info]    500     BigInt    167.42 =
[info]    500    BigInt2    189.04 =
[info]    500 BigInteger    166.66 =
[info]    500      Apint   3477.62 =
[info]   1000     BigInt    516.79 =
[info]   1000    BigInt2    607.99 =
[info]   1000 BigInteger    539.69 =
[info]   1000      Apint   6758.57 =
[info]   5000     BigInt   5870.79 =
[info]   5000    BigInt2   6921.23 =
[info]   5000 BigInteger   6016.35 =
[info]   5000      Apint  36703.25 =========
[info]  10000     BigInt  17038.29 ====
[info]  10000    BigInt2  19003.85 =====
[info]  10000 BigInteger  17147.78 ====
[info]  10000      Apint  71877.42 ===================
[info]  20000     BigInt  49250.33 =============
[info]  20000    BigInt2  55808.32 ==============
[info]  20000 BigInteger  53593.57 ==============
[info]  20000      Apint 112370.57 ==============================

Addition

  • Scala 2.10.3 JDK 7
[info] length  benchmark    ns linear runtime
[info]     32     BigInt   345 =
[info]     32    BigInt2   230 =
[info]     32 BigInteger   217 =
[info]     32      Apint  2202 =
[info]     64     BigInt   287 =
[info]     64    BigInt2   272 =
[info]     64 BigInteger   252 =
[info]     64      Apint  2248 =
[info]    200     BigInt   319 =
[info]    200    BigInt2   266 =
[info]    200 BigInteger   250 =
[info]    200      Apint  1934 =
[info]    500     BigInt   398 =
[info]    500    BigInt2   377 =
[info]    500 BigInteger   384 =
[info]    500      Apint  2581 =
[info]   1000     BigInt   630 =
[info]   1000    BigInt2   513 =
[info]   1000 BigInteger   570 =
[info]   1000      Apint  3671 =
[info]   5000     BigInt  2526 =
[info]   5000    BigInt2  2557 =
[info]   5000 BigInteger  2260 =
[info]   5000      Apint 10423 ===
[info]  10000     BigInt  3983 =
[info]  10000    BigInt2  4694 =
[info]  10000 BigInteger  4218 =
[info]  10000      Apint 20574 =======
[info]  50000     BigInt 22163 ========
[info]  50000    BigInt2 21185 =======
[info]  50000 BigInteger 21511 ========
[info]  50000      Apint 80148 ==============================
  • Scala 2.10.3 JDK 8
[info] length  benchmark    ns linear runtime
[info]     32     BigInt   412 =
[info]     32    BigInt2   215 =
[info]     32 BigInteger   224 =
[info]     32      Apint  2296 =
[info]     64     BigInt   367 =
[info]     64    BigInt2   261 =
[info]     64 BigInteger   280 =
[info]     64      Apint  2390 =
[info]    200     BigInt   432 =
[info]    200    BigInt2   242 =
[info]    200 BigInteger   305 =
[info]    200      Apint  2387 =
[info]    500     BigInt   465 =
[info]    500    BigInt2   365 =
[info]    500 BigInteger   380 =
[info]    500      Apint  2953 =
[info]   1000     BigInt   715 =
[info]   1000    BigInt2   527 =
[info]   1000 BigInteger   657 =
[info]   1000      Apint  3881 =
[info]   5000     BigInt  2640 =
[info]   5000    BigInt2  2753 =
[info]   5000 BigInteger  2715 =
[info]   5000      Apint 11168 ===
[info]  10000     BigInt  3982 =
[info]  10000    BigInt2  5024 =
[info]  10000 BigInteger  4828 =
[info]  10000      Apint 19588 ======
[info]  50000     BigInt 21204 =======
[info]  50000    BigInt2 23601 =======
[info]  50000 BigInteger 23059 =======
[info]  50000      Apint 90081 ==============================

Left Shift

  • Scala 2.10.3 JDK 7
[info] param      benchmark      ns linear runtime
[info]    32     BigIntLeft   141.6 =
[info]    32    BigInt2Left    97.7 =
[info]    32 BigIntegerLeft    86.3 =
[info]    64     BigIntLeft   157.8 =
[info]    64    BigInt2Left   113.8 =
[info]    64 BigIntegerLeft   100.5 =
[info]   200     BigIntLeft   206.5 =
[info]   200    BigInt2Left   186.3 =
[info]   200 BigIntegerLeft   136.8 =
[info]   500     BigIntLeft   310.4 =
[info]   500    BigInt2Left   247.9 =
[info]   500 BigIntegerLeft   220.7 =
[info]  1000     BigIntLeft   432.8 =
[info]  1000    BigInt2Left   444.6 =
[info]  1000 BigIntegerLeft   369.4 =
[info]  5000     BigIntLeft  1720.9 ===
[info]  5000    BigInt2Left  1846.2 ===
[info]  5000 BigIntegerLeft  1606.1 ==
[info] 10000     BigIntLeft  3531.7 ======
[info] 10000    BigInt2Left  2657.6 ====
[info] 10000 BigIntegerLeft  3151.2 =====
[info] 50000     BigIntLeft 14288.2 =========================
[info] 50000    BigInt2Left 16497.2 ==============================
[info] 50000 BigIntegerLeft 14451.9 ==========================
  • Scala 2.10.3 JDK 8
[info] param      benchmark      ns linear runtime
[info]    32     BigIntLeft   178.3 =
[info]    32    BigInt2Left    87.7 =
[info]    32 BigIntegerLeft    70.1 =
[info]    64     BigIntLeft   167.8 =
[info]    64    BigInt2Left    96.6 =
[info]    64 BigIntegerLeft    80.1 =
[info]   200     BigIntLeft   217.2 =
[info]   200    BigInt2Left   147.5 =
[info]   200 BigIntegerLeft   115.3 =
[info]   500     BigIntLeft   267.4 =
[info]   500    BigInt2Left   210.6 =
[info]   500 BigIntegerLeft   206.5 =
[info]  1000     BigIntLeft   374.1 =
[info]  1000    BigInt2Left   400.5 =
[info]  1000 BigIntegerLeft   310.7 =
[info]  5000     BigIntLeft  1567.0 ==
[info]  5000    BigInt2Left  1827.0 ===
[info]  5000 BigIntegerLeft  1489.3 ==
[info] 10000     BigIntLeft  2960.3 =====
[info] 10000    BigInt2Left  3133.2 =====
[info] 10000 BigIntegerLeft  2858.0 ====
[info] 50000     BigIntLeft 13710.6 =======================
[info] 50000    BigInt2Left 17587.2 ==============================
[info] 50000 BigIntegerLeft 13612.3 =======================
Clone this wiki locally