-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] In-memory database #32
Comments
Hi @Techno-coder thank you for the suggestion. I really appreciate it I think holding the whole database in memory and query from there directly is a great idea. Can you elaborate on how one may use this feature? Anyway this is great. I'd love to work on this feature. Please let me know what you think. |
At the moment I'm loading the prebuilt database from This answer on StackOverflow dumps the database into a |
I use |
Hi @Techno-coder again. I have added a new data source type into puchikarui based on your suggestion. The actual code change is in on this line https://github.com/letuananh/puchikarui/blob/ec4f445d29373c98de64e51aee2760cb58ab2258/puchikarui/puchikarui.py#L273 This data source is available from puchikarui 0.2a1 on PyPI: https://pypi.org/project/puchikarui/0.2a1/ To use this feature one can just pass in a MemorySource object as path, for example: from puchikarui import Database, MemorySource
db = Database(MemorySource("source.db"))
ctx = db.open() # this ctx will operate on :memory:
... With this, I added a new kwarg jam = Jamdict(memory_mode=True) On my computer this takes about a minute to load. I haven't tested to see how much the query performance is improved. This change will be available on Jamdict >= 0.1a10. I only deployed it to TestPyPI though: https://test.pypi.org/project/jamdict/0.1a10/ You can install this from Github or TestPyPI
I'll test this change a little bit more before releasing it to PyPI. Mean while it's best if you can help me to test it out to see how it works on your side. Thank you. |
Thank you very much for working on this feature! It looks like it's working as intended on my end. Without
With
The time spent in By the way, I had to enable
Not sure why I'm getting this error since it doesn't look like the code's changed between versions. Maybe I've messed up my environment somehow? |
Hi again. Thanks for your performance test log. This looks great. As for the |
Yep, updating to |
Yay, this is great, thanks! I will test it a little bit more, and will deploy it to PyPI soon. |
Hi, I have tested Jamdict 0.1a10 on several OSes with different setup and now it's live on PyPI https://pypi.org/project/jamdict/0.1a10/ If you have any issue please feel free to open this thread to continue or create a new one. Thanks again for suggesting this feature. |
Hi there, thanks for making this library! I was wondering if it's possible to add an option for the database to be forcibly created in memory:
I added this snippet to
puchikarui.py
and it sped up lookups by about 30-40% (7.7 seconds down to ~4 seconds). Of course, ideally the database would be kept outside of the context construction. I'm currently have reuse of contexts enabled.The text was updated successfully, but these errors were encountered: