Qualified's blog

By Qualified, history, 4 years ago, In English

KACTL ModMul. It says that it runs around 2x faster than naive

(__int128_t)a * b % M

When I ran my benchmarks with -O2, the results were similar. Am I mistaken?

  • Vote: I like it
  • -29
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

This is only one mod operation, try doing more operations and benchmarking.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I did that. I did 1e5 runs and their running time was basically the same.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      1e5 operations is not very many. That should take around 1 millisecond. Try something like 1e10 of them to spot a consistent difference. Also make sure the compiler can't optimize it out.