File: suggest_timing_commands.txt

package info (click to toggle)
python-sphobjinv 2.3.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,328 kB
  • sloc: python: 4,194; makefile: 29; sh: 20
file content (33 lines) | stat: -rw-r--r-- 2,935 bytes parent folder | download
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
26
27
28
29
30
31
32
33
In [19]: print(*ho.get_range(711), sep='\n')
(711, 1, 'import sphobjinv as soi')
(711, 2, 'import os')
(711, 3, 'import timeit')
(711, 4, 'import csv')
(711, 5, 'results = {}')
(711, 6, 'lengths = {}')
(711, 7, 'for fn in os.listdir():\n    if fn.endswith(\'.inv\'):\n        inv = soi.Inventory(fn)\n        timings = timeit.repeat("inv.suggest(\'function\')", repeat=count, number=1, globals=globals())\n        results.update({fn: sum(timings) / len(timings)})\n        lengths.update({fn: inv.count})\n        print((fn, results[fn], lengths[fn]))\n        ')
(711, 8, 'count = 20')
(711, 9, 'for fn in os.listdir():\n    if fn.endswith(\'.inv\'):\n        inv = soi.Inventory(fn)\n        timings = timeit.repeat("inv.suggest(\'function\')", repeat=count, number=1, globals=globals())\n        results.update({fn: sum(timings) / len(timings)})\n        lengths.update({fn: inv.count})\n        print((fn, results[fn], lengths[fn]))\n        ')
(711, 10, "with open('\\\\git\\\\with-leven.csv', 'w') as f:\n    csvw = csv.writer(f)\n    for fn in results:\n        csvw.writerow([fn, lengths[fn], results[fn]])\n        ")

In [20]: print(*ho.get_range(710), sep='\n')
(710, 1, 'import sphobjinv as soi')
(710, 2, 'results = {}')
(710, 3, 'import os')
(710, 4, "for fn in os.listdir():\n    if fn.endswith('.inv'):\n        inv = soi.Inventory(fn)\n        ")
(710, 5, 'import timeit')
(710, 6, 'count = 20')
(710, 7, 'timeit.repeat?')
(710, 8, 'for fn in os.listdir():\n    if fn.endswith(\'.inv\'):\n        inv = soi.Inventory(fn)\n        timings = timeit.repeat("inv.suggest(\'function\')", repeat=count, number=1, globals=globals())\n        results.update({fn: sum(timings) / len(timings)})\n        ')
(710, 9, 'results')
(710, 10, 'lengths = {}')
(710, 11, 'results = {}')
(710, 12, 'for fn in os.listdir():\n    if fn.endswith(\'.inv\'):\n        inv = soi.Inventory(fn)\n        timings = timeit.repeat("inv.suggest(\'function\')", repeat=count, number=1, globals=globals())\n        results.update({fn: sum(timings) / len(timings)})\n        lengths.update({fn: inv.count})\n        ')
(710, 13, 'results')
(710, 14, 'lengths')
(710, 15, 'results = {}')
(710, 16, 'lengths = {}')
(710, 17, 'for fn in os.listdir():\n    if fn.endswith(\'.inv\'):\n        inv = soi.Inventory(fn)\n        timings = timeit.repeat("inv.suggest(\'function\')", repeat=count, number=1, globals=globals())\n        results.update({fn: sum(timings) / len(timings)})\n        lengths.update({fn: inv.count})\n        print((fn, results[fn], lengths[fn]))\n        ')
(710, 18, 'import csv')
(710, 19, "with open('\\\\git\\\\no-leven.csv', 'w') as f:\n    csvw = csv.writer(f)\n    for fn in results:\n        csvw.writeline([fn, lengths[fn], results[fn]])\n        ")
(710, 20, "with open('\\\\git\\\\no-leven.csv', 'w') as f:\n    csvw = csv.writer(f)\n    for fn in results:\n        csvw.writerow([fn, lengths[fn], results[fn]])\n        ")