crchemist crchemist-laptop time python py python py 34s user 02s syste

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crchemist@crchemist-laptop ~> time python t.py
python t.py 0,34s user 0,02s system 99% cpu 0,360 total
crchemist@crchemist-laptop ~> cat t.py
import re
import timeit
def str_split_1(str_or_patt):
if isinstance(str_or_patt, str):
return lambda x: x.split(str_or_patt)
else:
return lambda x: re.split(str_or_patt, x)
def str_split_2(str_or_patt, s):
if isinstance(str_or_patt, str):
return s.split(str_or_patt)
else:
return re.split(str_or_patt, s)
def process(a):
a * 10
my_split = str_split_1(',')
for string in ['soe, string s' * 8] * 90000:
process(my_split(string))
crchemist@crchemist-laptop ~>