> Because it's so so slow, even naively converting multiplication in a series 
> of modular additions is much faster:

dunno about this one - after fixing the insanely slow recursion, changing the 
implementation to a simple natural mul+divrem 100x:ed the performance - this is 
the textbook implementation and doesn't even try to be efficient (ie no special 
cases for different modulos, small numbers, montgomerys and whatnot. I'm sure 
this is trivial to both benchmark and implement better but the iteration 
approach sure doesn't look like a winner from this sample of one :)

<https://github.com/status-im/nim-stint/pull/156>

Reply via email to