# Path: mom/tests/speed.py
# def report(stmt, setup, number=0, verbose=0, precision=3,
#            repeat=timeit.default_repeat, timer=timeit.default_timer):
#   sys.stdout.write("%50s -- " % stmt)
#   t = timeit.Timer(stmt, setup, timer)
#   if number == 0:
#     # determine number so that 0.2 <= total time < 2.0
#     for i in range(1, 10):
#       number = 10 ** i
#       try:
#         x = t.timeit(number)
#       except Exception:
#         t.print_exc()
#         return 1
#       if verbose:
#         print("%d loops -> %.*g secs" % (number, precision, x))
#       if x >= 0.2:
#         break
#   try:
#     r = t.repeat(repeat, number)
#   except Exception:
#     t.print_exc()
#     return 1
#   best = min(r)
#   if verbose:
#     print("raw times:", " ".join(["%.*g" % (precision, x) for x in r]))
#   sys.stdout.write("%d loops, " % number)
#   usec = best * 1e6 / number
#   if usec < 1000:
#     print("best of %d: %.*g usec per loop" % (repeat, precision, usec))
#   else:
#     msec = usec / 1000
#     if msec < 1000:
#       print("best of %d: %.*g msec per loop" % (repeat, precision, msec))
#     else:
#       sec = msec / 1000
#       print("best of %d: %.*g sec per loop" % (repeat, precision, sec))


import sys
from mom.tests.speed import report
  "rfc1924_b85encode(b)",
  "rfc1924_b85decode(b)",
  None,
  "integer_byte_length(n)",
  "integer_byte_length_word_aligned(n)",
  "integer_byte_length_shift_counting(n)",
  None,
  "integer_bit_length(n)",
  "integer_bit_length_word_aligned(n)",
  "integer_bit_length_shift_counting(n)",
  None,
  "uint_to_bytes(n)",
  "uint_to_bytes_simple(n)",
  "uint_to_bytes_array_based(n)",
  "uint_to_bytes_pycrypto(n)",
  "uint_to_bytes_naive(n)",
  "uint_to_bytes_naive_array_based(n)",
  None,
  "bytes_to_uint(b)",
  "bytes_to_uint_naive(b)",
  "bytes_to_uint_simple(b)",
]


def main(setups, statements):
  print("Python %s" % sys.version)
  for setup, statement in zip(setups, statements):
    if setup is None or statement is None:
      print("")
    else:

# Path: mom/tests/speed.py
# def report(stmt, setup, number=0, verbose=0, precision=3,
#            repeat=timeit.default_repeat, timer=timeit.default_timer):
#   sys.stdout.write("%50s -- " % stmt)
#   t = timeit.Timer(stmt, setup, timer)
#   if number == 0:
#     # determine number so that 0.2 <= total time < 2.0
#     for i in range(1, 10):
#       number = 10 ** i
#       try:
#         x = t.timeit(number)
#       except Exception:
#         t.print_exc()
#         return 1
#       if verbose:
#         print("%d loops -> %.*g secs" % (number, precision, x))
#       if x >= 0.2:
#         break
#   try:
#     r = t.repeat(repeat, number)
#   except Exception:
#     t.print_exc()
#     return 1
#   best = min(r)
#   if verbose:
#     print("raw times:", " ".join(["%.*g" % (precision, x) for x in r]))
#   sys.stdout.write("%d loops, " % number)
#   usec = best * 1e6 / number
#   if usec < 1000:
#     print("best of %d: %.*g usec per loop" % (repeat, precision, usec))
#   else:
#     msec = usec / 1000
#     if msec < 1000:
#       print("best of %d: %.*g msec per loop" % (repeat, precision, msec))
#     else:
#       sec = msec / 1000
#       print("best of %d: %.*g sec per loop" % (repeat, precision, sec))


# Path: run_speed_tests.py
import sys
from mom.tests.speed import report

  "rfc1924_b85encode(b)",
  "rfc1924_b85decode(b)",
  None,
  "integer_byte_length(n)",
  "integer_byte_length_word_aligned(n)",
  "integer_byte_length_shift_counting(n)",
  None,
  "integer_bit_length(n)",
  "integer_bit_length_word_aligned(n)",
  "integer_bit_length_shift_counting(n)",
  None,
  "uint_to_bytes(n)",
  "uint_to_bytes_simple(n)",
  "uint_to_bytes_array_based(n)",
  "uint_to_bytes_pycrypto(n)",
  "uint_to_bytes_naive(n)",
  "uint_to_bytes_naive_array_based(n)",
  None,
  "bytes_to_uint(b)",
  "bytes_to_uint_naive(b)",
  "bytes_to_uint_simple(b)",
]


def main(setups, statements):
  print("Python %s" % sys.version)
  for setup, statement in zip(setups, statements):
    if setup is None or statement is None:
      print("")
    else:

      report(statement, setup)