arange.py 392 B

1234567891011121314151617181920212223
  1. from time import time
  2. import numpy as np
  3. import bcolz
  4. N = 1e8
  5. dtype = 'i4'
  6. start, stop, step = 5, N, 4
  7. t0 = time()
  8. a = np.arange(start, stop, step, dtype=dtype)
  9. print("Time numpy.arange() --> %.3f" % (time() - t0))
  10. t0 = time()
  11. ac = bcolz.arange(start, stop, step, dtype=dtype)
  12. print("Time bcolsz.arange() --> %.3f" % (time() - t0))
  13. print("ac-->", repr(ac))
  14. # assert(np.all(a == ac))