libff icon indicating copy to clipboard operation
libff copied to clipboard

Change fp_model's mulreduce to not check limbsize in run-time

Open ValarDragon opened this issue 3 years ago • 0 comments

The multiplication function in a finite field currently checks in runtime what the limb size is, when its instead known at compile time as its a template parameter.

Line where we check this: https://github.com/scipr-lab/libff/blob/52d77c3ee213b0f1fb49402374f1cf099bb972dd/libff/algebra/fields/fp.tcc#L27

I don't know if this is optimized out by the compiler on all platforms, but if it isn't this is potentially quite bad for the instruction cache (in addition to slight overhead due to the branch-predicted conditional)

ValarDragon avatar Oct 11 '20 02:10 ValarDragon