I'm looking to maximally optimize the runtime for this chunk of code:
aDictionary= {"key":["value", "value2", ...
rests = \
list(map((lambda key: Resp(key=key)),
[key for key, values in
aDictionary.items() if (test1 in values or test2 in values)]))
using python3. willing to throw as much memory at it as possible.
considering throwing the two dictionary lookups on separate processes for speedup (does that make sense?). any other optimization ideas welcome
- values can definitely be sorted and turned into a set; it is precomputed, very very large.
- always len(values) >>>> len(tests), though they're both growing over time
- len(tests) grows very very slowly, and has new values for each execution
- currently looking at strings (considering doing a string->integer mapping)