Carl Friedrich Bolz-Tereick <cfb...@gmx.de> added the comment:

Somebody pointed me to V8's implementation of str(bigint) today:

https://github.com/v8/v8/blob/main/src/bigint/tostring.cc

They say that they can compute str(factorial(1_000_000)) (which is 5.5 million 
decimal digits) in 1.5s:

https://twitter.com/JakobKummerow/status/1487872478076620800

As far as I understand the code (I suck at C++) they recursively split the 
bigint into halves using % 10^n at each recursion step, but pre-compute and 
cache the divisors' inverses.

----------
nosy: +Carl.Friedrich.Bolz

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46558>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to