| 1 |
|
| 2 |
|
| 3 |
import builtins |
| 4 |
|
| 5 |
try: |
| 6 |
builtins.profile |
| 7 |
except AttributeError: |
| 8 |
|
| 9 |
def profile(func): |
| 10 |
return func |
| 11 |
|
| 12 |
builtins.profile = profile |
| 13 |
|
| 14 |
import numpy as np |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
arr = [i for i in range(1, 1000)] |
| 21 |
|
| 22 |
|
| 23 |
@profile |
| 24 |
def doit1(x): |
| 25 |
|
| 26 |
y = 1 |
| 27 |
|
| 28 |
x = [i * i for i in range(0, 100000)][99999] |
| 29 |
y1 = [i * i for i in range(0, 200000)][199999] |
| 30 |
z1 = [i for i in range(0, 300000)][299999] |
| 31 |
z = x * y |
| 32 |
|
| 33 |
return z |
| 34 |
|
| 35 |
|
| 36 |
def doit2(x): |
| 37 |
i = 0 |
| 38 |
|
| 39 |
|
| 40 |
z = 0.1 |
| 41 |
while i < 100000: |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
z = z * z |
| 47 |
z = x * x |
| 48 |
z = z * z |
| 49 |
z = z * z |
| 50 |
i += 1 |
| 51 |
return z |
| 52 |
|
| 53 |
|
| 54 |
@profile |
| 55 |
def doit3(x): |
| 56 |
for i in range(1000000): |
| 57 |
z = x + 1 |
| 58 |
z = x + 1 |
| 59 |
z = x + 1 |
| 60 |
z = x + z |
| 61 |
z = x + z |
| 62 |
|
| 63 |
return z |
| 64 |
|
| 65 |
|
| 66 |
def stuff(): |
| 67 |
|
| 68 |
x = 1.01 |
| 69 |
for i in range(1, 3): |
| 70 |
|
| 71 |
for j in range(1, 3): |
| 72 |
x = doit1(x) |
| 73 |
x = doit2(x) |
| 74 |
x = doit3(x) |
| 75 |
x = 1.01 |
| 76 |
return x |
| 77 |
|
| 78 |
|
| 79 |
import sys |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
stuff() |