Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved BFV Multiply (10%~) #185

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

fionser
Copy link
Contributor

@fionser fionser commented Jun 23, 2020

  • Base conversion needs many multiplications with some precomputed CRT factors.
    Thus, we can use the faster mulmod method via Shoup's trick, i.e. using the preconditioner floor(y*2^64/p).

  • Same reason for multiply_poly_scalar_coeffmod.

  • Performance from sealexample.cpp

clang on 2.3 GHz Intel Core i5

N = 16384 case

Average multiply: 74751 microseconds --> 65250 
Average square: 54233 microseconds --> 49981

N = 32768 case

Average multiply: 318894 microseconds --> 288964
Average square: 234881 microseconds --> 217261

g++-7 on Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz

N = 16384 case

Average multiply: 89885 microseconds  —> 80355 
Average square: 66607 microseconds —> 60430

N = 32768 case

Average multiply: 380883 microseconds —> 348200 
Average square: 286745 microseconds —> 264523

* Base conversion needs many multiplications with some precomputed CRT factors.
  Thus, we can use the faster mulmod method via Shoup's trick, i.e. using the preconditioner floor(y*2^64/p).
* Same reason for multiply_poly_scalar_coeffmod.
@WeiDaiWD
Copy link
Contributor

Thanks again for your valuable contribution. It will appear in the next release with some changes.

@WeiDaiWD WeiDaiWD merged commit e11cae9 into microsoft:contrib Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants