I have a Python dictionary of size ~ 1000 entries. A script will be called repeatedly, that will want to parse the string and see if any keys in the string match. If they do, it will require certain actions based on the key and value.
Which one is faster?
1) Store the dictionary in the MySQL database and then read the database every time the script is called?
2) Save the dictionary in a Python script and import it every time? (for example, create a file that contains nothing but dictionary initialization)
3) Save the dictionary in a text file and import it every time? (either a flat text file or a serialized data file using cpickle)
Just look for the best practice here.
anon
source
share