bn.js
bn.js copied to clipboard
bn: introduce small pow, .pown() [WIP]
trafficstars
Compared to the benchmarks in #121 it performs as:
bn.js pown#pow x 11,994 ops/sec ±3.01% (9 runs sampled)
bn.js ipown#pow x 11,417 ops/sec ±5.09% (9 runs sampled)
However on bigger powers it is different. Take this PR as a WIP at the moment.
Any update?
I think technically works (but would need a rebase and confirming it still works), however perhaps the gain wasn't significant enough at the time?
If there's interest getting this merged, I can rebase it.
I'm new at bn.js and in my first day I needed a function like this. Current pow function needs a BN instance which is not usable much for standard js numbers, adds extra code. @indutny ?