Embedded keystores are faster enough in python3. Take as baseline the native dict, say
for k in random.choices(auList,k=100000000):
a=auDict[k]
CPU times: user 1min 6s, sys: 1.07 s, total: **1min 7s**
GDBM does not travel bad against this
%%time
with db.open("AuDictJson.gdbm",'r') as d:
for k in random.choices(auList,k=100000000):
a=d[str(k)]
CPU times: user 2min 44s, sys: 1.31 s, total: **2min 45s**
And even a specialist precompiled table, as keyvy for json serializated lists, can do almost the same.
%%time
d = keyvi.Dictionary("AuDictJson.keyvi")
for k in random.choices(auList,k=100000000):
a=d[str(k)].GetValue()
CPU times: user 7min 45s, sys: 1.48 s, total: 7min 47s
Generically an embedded database, specially when it is read-only and single user, should be expected always to win an external one, because of the overhead of sockets and semaphores to access the resource. On the other hand, if your program is a service having already some external I/O bottleneck -say, you are writing a webservice-, the overhead to access the resource could unimportant.
Said that, you can see some advantage on using external databases if they provide extra services. For Redis, consider union of sets.
%%time
for j in range(1000):
k=r.sunion(('s'+str(k) for k in random.choices(auList,k=10000)))
CPU times: user 2min 24s, sys: 758 ms, total: 2min 25s
Same task with gbm is in the same order of magnitude. Albeit redis is still five times slower, it is not so slow as to discard it
%%time
with db.open("AuDictPSV.gdbm",'r') as d:
for j in range(1000):
a=set()
for k in random.choices(auList,k=10000):
a.update(d[str(k)].split(b'|'))
CPU times: user 33.6 s, sys: 3.5 ms, total: 33.6 s
By using redis in this case, you get the full functionality of a database, beyond a simple datastore. Of course, with a lot of clients saturating it, of with a lot of single gets, it is going to perform poorly compared to the embedded resource.
As for gdbm competition, a 2014 benchmark by Charles Leifer shows that it can overperform KyotoCabinet for reads still tie for writting, and that one could consder LevelDB and RocksDB as advanced alternatives.