Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/python/bench/src/misc.py
1067 views
1
from bench import register, all
2
3
4
# JPython is really bad at these, since Javascript
5
# doesn't really have a notion of generic lists.
6
def list_times_number(n=100):
7
for i in range(n):
8
[0] * 100000
9
10
11
register('list_times_number', list_times_number)
12
13
14
def list_times_number2(n=1000000):
15
v = [1, 2, list(range(100))]
16
len(v * n)
17
18
19
register('list_times_number2', list_times_number2)
20
21
22
def list_times_number3(n=1000000):
23
w = [0]
24
for i in range(n):
25
w * 3
26
27
28
register('list_times_number3', list_times_number3)
29
30
31
def list_to_string(n=10**5):
32
len(str(list(range(n))))
33
34
35
register("list_to_string", list_to_string)
36
37
if __name__ == '__main__':
38
all()
39
40