On Tuesday, January 14, 2020 at 5:36:27 AM UTC-8, Александр Ватузов wrote:
>
> Now I constantly know, that problem was in using
>
> divmod(n, base**half)
>
> instead of
>
> n // (base**half), n % (base**half)
>

The second option yields a performance regression relative to the first, 
because you would end up doing an integer division twice rather than one 
(integer division yields both the quotient and the remainder, so throwing 
one away and then recomputing it to find it anyway is wasteful). You're 
also performing an exponentiation twice.

I think it would be better to find/write a "divmod" that works in py3 as 
well.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/78a83c70-0f12-4df0-a2e4-d4a499b388bf%40googlegroups.com.

Reply via email to