perf: ATE_LOOP_COUNT hamming weight reduced from 26 to 22 - #852
Conversation
|
Thank you for the PR! Could you add a test showing that the two miller loops are equivalent, or some other justification of how you were able to reduce the hamming weight? Thank you! |
|
Hi, we noticed the current ATE_LOOP_COUNT in BN254 curve is not in NAF form since it has consecutive non-zero elements at a few places. It has 26 non-zero elements and its length is 65. This is however, is still a signed-digit representation of the correct value This version has Hamming weight 22 but has length 66. However, the last 3 bits in this representation (..., -1, 0, 1) is equivalent to the last 2 bits of the current version (..., 1, 1). That is because |
|
Also, they both passing the following assert would mean they are equivalent. |
|
Great, thank you! |
Description
ATE_LOOP_COUNT in the BN254 curve has been updated, so the new version has a 22 hamming weight, while previous one had 26.