Debian Codegraph @

test/profile_annotation_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 import builtins
4
5 try:
6 builtins.profile
7 except AttributeError:
8 # No line profiler, provide a pass-through version
9 def profile(func):
10 return func
11
12 builtins.profile = profile
13
14 import numpy as np
15
16 # import math
17
18 # from numpy import linalg as LA
19
20 arr = [i for i in range(1, 1000)]
21
22
23 @profile
24 def doit1(x):
25 # x = [i*i for i in range(1,1000)][0]
26 y = 1
27 # w, v = LA.eig(np.diag(arr)) # (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)))
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 # z = np.multiply(x, y)
33 return z
34
35
36 def doit2(x):
37 i = 0
38 # zarr = [math.cos(13) for i in range(1,100000)]
39 # z = zarr[0]
40 z = 0.1
41 while i < 100000:
42 # z = math.cos(13)
43 # z = np.multiply(x,x)
44 # z = np.multiply(z,z)
45 # z = np.multiply(z,z)
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 # z = np.cos(x)
63 return z
64
65
66 def stuff():
67 # y = np.random.randint(1, 100, size=50000000)[49999999]
68 x = 1.01
69 for i in range(1, 3):
70 # print(i)
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 # print("TESTME")
82 # print(sys.argv)
83 stuff()