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
Allow to turn off stacktrace bookkeeping #96
Conversation
Can you post some benchmarks? before / after your PR. Intuitively, I'd expect debugging features that significantly slow down normal execution to be an opt-in, not opt-out. But if the difference is "slight", as per PR #28, it's OK as opt-out for power-users. So the benchmark numbers matter. CC @jquast . |
@mpenkov Thanks for the review - Amended the commit based on your comments, PTAL |
@piskvorky Although I cannot share my code (not open source), I observed a similar improvement as shown above (about ~23x faster after than before, although I didn't compute the variance in the real use case, as opposed to above). FWIW I am evaluating this map compared to a leveldb index and sqlitedict is still ~4x slower than leveldb in my use case. |
Yeah, that wouldn't surprise me. Sqlitedict is aiming to be a simple-to-use wrapper for SQLite, speed is not one of our primary objectives. |
@piskvorky LMK if you think I should make this the default behavior |
@yonromai I'm not very familiar with this part of the code. Can you summarize the pros/cons? What would we (the users, the developers) gain / lose by making it the default? |
Pro: Inserts are 23x faster. |
I'm not sure. I'm leaning slightly toward more intelligible messages… but damn, 23x is a lot! How often / under what conditions can these errors happen? In our code, in user code…? @mpenkov WDYT?
That message is too vague: where should I (as a user) enter this |
@yonromai why did you close this PR? |
@mpenkov I closed the PR because it's been stale and I'm trying to keep my github.com/pulls clean since I use it a lot. I kept the fork alive in case you want to cherry pick the changes. |
Are you able to complete the PR? You received feedback from @piskvorky. From what I can see:
|
@mpenkov Sorry but I don't have much more bandwidth to dedicate to this (we decided to not use |
OK, that's fair enough. Thanks for the changes in your PR. We'll take it from here. |
Has there been any progress on this PR? |
@imachug No. Are you interested in fixing this? |
I thought this PR is more or less ready to merge, except maybe
Do you have any other issues with this? |
No, TBH, I think that's the only thing left. Let me go clean up the error message and we can merge this. |
@@ -140,6 +141,8 @@ def __init__(self, filename=None, tablename='unnamed', flag='c', | |||
object. | |||
The default is to use pickle. | |||
|
|||
If you disable `outer_stack`, the stacktrace at insert time won't be saved. This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More context / info please. As a user, what is "the stacktrace at insert time", what are the implications of "not saving" it? Why would I want / not want that?
Hi,
The
stack = traceback.extract_stack()[:-1]
instruction makes inserts too slow for my use case.This PR adds a flag to disable this behavior if needed.
According to some basic testing, it speeds up inserts by ~20x:
Test code:
=>
2.68 s ± 42.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
=>
121 ms ± 3.04 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)