summaryrefslogtreecommitdiff
path: root/components/rtgui/utils/perfect_hash/example-PyModule/test.py
blob: 02c06b69266cbd251f82781aca0b6a08a0bd1244 (plain)
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
#!/usr/bin/env python
import sys
from timeit import Timer
from stations import locator

call = sys.argv[1]
print repr(call)
D = {}

for line in file('stations.dat'):
    c, l = [x.strip() for x in line.split(',')]
    D[c] = l

def test1(c):
    return D[c]

print repr(test1(call))
t = Timer("test1(%r)" % call, "from __main__ import test1")
print t.timeit()

# -----

def test2(c):
    return locator(c)

print repr(test2(call))
t = Timer("test2(%r)" % call, "from __main__ import test2")
print t.timeit()