You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
734 B

25 years ago
25 years ago
25 years ago
  1. #include <cln/number.h>
  2. #include <cln/io.h>
  3. #include <cln/integer.h>
  4. #include <cln/integer_io.h>
  5. #include <cln/random.h>
  6. #include <cstdlib>
  7. #include <cstring>
  8. #include <cln/timing.h>
  9. #include <cln/malloc.h>
  10. using namespace cln;
  11. int main (int argc, char * argv[])
  12. {
  13. int repetitions = 1;
  14. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  15. repetitions = atoi(argv[2]);
  16. argc -= 2; argv += 2;
  17. }
  18. if (argc < 2)
  19. exit(1);
  20. cl_I m = cl_I(argv[1]);
  21. cl_I M = (cl_I)1 << (intDsize*m);
  22. cl_I a = random_I(M);
  23. // One run to fill the cache.
  24. {
  25. char* p = cl_decimal_string(a);
  26. free_hook(p);
  27. }
  28. // Now start the timing.
  29. { CL_TIMING;
  30. for (int rep = repetitions; rep > 0; rep--)
  31. { char* p = cl_decimal_string(a); free_hook(p); }
  32. }
  33. }