, MySQL ( -, ), Python dict IO ( ). , (x_pos, y_pos) 55 x 55 ( 3000 , 55 ^ 2 3000).
>>> the_dict = { (x, y) : None for x in range(55) for y in range (55) }
>>> len(the_dict)
3025
>>> import random
>>> xs = [random.randrange(0,110) for _ in range(55)]
>>> ys = [random.randrange(0,110) for _ in range(55)]
>>> import timeit
>>> total_secs = timeit.timeit("for x,y in zip(xs, ys): (x,y) in the_dict",
setup="from __main__ import xs, ys, the_dict", number=100000)
>>> each_secs = total_secs / 100000
>>> each_secs
1.1723998441142385e-05
>>> each_usecs = 1000000 * each_secs
>>> each_usecs
11.723998441142385
>>> usecs_per_lookup = each_usecs / (55*55)
>>> usecs_per_lookup
0.0038757019640140115
0.004 (!) - , , ;) 2.4, YMMV .
, ints ( ( - ) , xor ).
, , ( ). , , .