Message412192
| Author |
tim.peters |
| Recipients |
Carl.Friedrich.Bolz, Dennis Sweeney, tim.peters |
| Date |
2022年01月31日.06:11:48 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1643609508.12.0.187844878718.issue46558@roundup.psfhosted.org> |
| In-reply-to |
| Content |
> todecstr treats it as an "input" conversion instead, ...
Worth pointing this out since it doesn't seem widely known: "input" base conversions are _generally_ faster than "output" ones. Working in the destination base (or a power of it) is generally simpler.
In the math.factorial(1000000) example, it takes CPython more than 3x longer for str() to convert it to base 10 than for int() to reconstruct the bigint from that string. Not an O() thing (they're both quadratic time in CPython today). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年01月31日 06:11:48 | tim.peters | set | recipients:
+ tim.peters, Carl.Friedrich.Bolz, Dennis Sweeney |
| 2022年01月31日 06:11:48 | tim.peters | set | messageid: <1643609508.12.0.187844878718.issue46558@roundup.psfhosted.org> |
| 2022年01月31日 06:11:48 | tim.peters | link | issue46558 messages |
| 2022年01月31日 06:11:48 | tim.peters | create |
|