SHARE
TWEET

Untitled

a guest Jun 21st, 2011 65 Never
  1. import numpy as np
  2. import timeit
  3.  
  4. N=4096
  5.  
  6. t_big=timeit.Timer('A.byteswap(True);A.tofile("a_big.bin")','import numpy;N={N};A=numpy.random.rand({N},{N})'.format(N=N))
  7. t_little=timeit.Timer('A.tofile("a_little.bin")','import numpy;N={N};A=numpy.random.rand({N},{N})'.format(N=N))
  8.  
  9. print("Running for little endian...")
  10. print t_little.repeat(5,10)
  11.  
  12. print("Running for big endian...")
  13. print t_big.repeat(5,10)
RAW Paste Data
Top