ddlog_bench.c 668 B

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