c++ - Is it really efficient to use Karatsuba algorithm in 64-bit x 64-bit multiplication? -
i work on avx2 , need calculate 64-bit x64-bit -> 128-bit widening multiplication , got 64-bit high part in fastest manner. since avx2 has not such instruction, reasonable me use karatsuba algorithm efficiency , gaining speed?
no. on modern architectures crossover @ karatsuba beats schoolbook multiplication somewhere between 8 , 24 machine words (e.g. between 512 , 1536 bits on x86_64). fixed sizes, threshold @ smaller end of range, , new adcx/adox instructions bring in further scalar code, 64x64 still small benefit karatsuba.
Comments
Post a Comment