Feedback on ex0.* and ex1.*
This commit is contained in:
parent
e363d023cd
commit
982866a7e6
6 changed files with 47 additions and 21 deletions
12
ex0.2/gen_rand_explicit.py
Normal file
12
ex0.2/gen_rand_explicit.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
N = 1e6
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
N = float(sys.argv[1])
|
||||
|
||||
for _ in range(int(N)):
|
||||
print( np.random.rand(1) )
|
|
@ -1,4 +1,10 @@
|
|||
Running `time ./gen_rand.py "1e9"` gives
|
||||
Running `time ./gen_rand.py "1e6"` gives
|
||||
|
||||
real 0m13.803s
|
||||
user 0m8.874s
|
||||
real 0m0.237s
|
||||
user 0m0.160s
|
||||
|
||||
Contrast this to the following:
|
||||
Running `time ./gen_rand_explicit.py "1e6"` gives
|
||||
|
||||
real 2m11.564s
|
||||
user 2m1.950s
|
||||
|
|
Reference in a new issue