Skip to content

Conversation

@Bodigrim
Copy link
Collaborator

@Bodigrim Bodigrim commented Jul 1, 2017

I've been long suspecting that {integer,natural}{,Word}Power functions are no better than (^) in contemporary GHC and base. Several months ago I have written benchmarks (branch wip-benchmarks). Results (https://github.com/Bodigrim/integer-logarithms/blob/wip-benchmarks/benchmark/results.csv) show that:

  • Depending on bit pattern of an exponent, integerPower appears slower or faster than (^). Typically it is 10% faster for exponents 2^n, 10% slower for exponents 2^n-1 and 30%-60% slower for exponents 2^n+1.
  • For Natural it appears that (^) is almost always faster (up to 60%) than naturalPower.

Taking into account such evidence, I find reasonable to deprecate {integer,natural}{,Word}Power and use (^) instead. I have already done it in arithmoi, without any negative consequences.

@Bodigrim Bodigrim merged commit 2117638 into master Jul 5, 2017
@Bodigrim Bodigrim deleted the power branch July 5, 2017 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants