Answered in comments.
I find the built-in function IntegerReverse[n]
is roughly an order of magnitude slower than the simple alternative FromDigits[Reverse[IntegerDigits[n]]]
.
Tests were made with the following code:
testnumbers = Range[10^4];
(IntegerReverse /@ testnumbers;) // Timing
((FromDigits[Reverse[IntegerDigits[#]]]&) /@ testnumbers;) // Timing
Version 11 gives:
{0.140625, Null}
{0.015625, Null}
Version 10 (on a different machine) gives:
{0.0625, Null}
{0.015625, Null}
This is a huge difference. I'm wondering if I'm missing a slowing feature of IntegerReverse
or something like that.
Can anyone confirm this result? Should we report this to wolfram?
<<GeneralUtilities`; PrintDefinitions[IntegerReverse]
to see the features and spot the differences. $\endgroup$