3 ms·
> The benchmark is converting numbers to strings, which in Python is remarkably expensive for reasons we'll get into. I was a bit disappointed that converting
by mark-r 6y ago
> The benchmark is converting numbers to strings, which in Python is remarkably expensive for reasons we'll get into.
I was a bit disappointed that converting numbers to strings was the only thing he didn't actually discuss. I've discovered that the conversion function is unnecessarily slow, basically O(n^2) on the number of digits. This despite being based on an algorithm from Knuth.