Shelve is too slow for large dictionaries, what can I do to improve performance?

后端 未结 4 725
滥情空心
滥情空心 2020-12-29 10:22

I am storing a table using python and I need persistence.

Essentially I am storing the table as a dictionary string to numbers. And the whole is stored with shelve

4条回答
  •  感情败类
    2020-12-29 10:44

    How much larger? What are the access patterns? What kinds of computation do you need to do on it?

    Keep in mind that you are going to have some performance limits if you can't keep the table in memory no matter how you do it.

    You may want to look at going to SQLAlchemy, or directly using something like bsddb, but both of those will sacrifice simplicity of code. However, with SQL you may be able to offload some of the work to the database layer depending on the workload.

提交回复
热议问题