ddlog_bench.c 633 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <assert.h>
  2. #include <stdint.h>
  3. #include <stdio.h>
  4. #include <strings.h>
  5. #include "ddlog.h"
  6. #include "entropy.h"
  7. #include "group.h"
  8. #include "timeit.h"
  9. #define SEP "\t"
  10. int main()
  11. {
  12. group_init();
  13. dlog_precompute();
  14. mpz_entropy_init();
  15. for (int i=0; i < (int) (0x01 << 16); i++) {
  16. mpz_t n;
  17. mpz_init(n);
  18. mpz_urandomm(n, _rstate, p);
  19. INIT_TIMEIT(CLOCK_PROCESS_CPUTIME_ID);
  20. START_TIMEIT();
  21. uint32_t steps = convert(n->_mp_d);
  22. END_TIMEIT();
  23. printf("%d" SEP "%u" SEP TIMEIT_FORMAT "\n",
  24. FAILURE, steps, GET_TIMEIT());
  25. mpz_clear(n);
  26. }
  27. group_clear();
  28. return 0;
  29. }