-
Notifications
You must be signed in to change notification settings - Fork 3
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
Skip unnecessary writes in default impl for modifyGet #70
base: master
Are you sure you want to change the base?
Conversation
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.
👍
@@ -37,6 +37,10 @@ proc defaultModifyGetImpl*( | |||
except CatchableError as err: | |||
return failure(err) | |||
|
|||
if maybeCurrentData == maybeNewData: |
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.
🔴 Well technically you should be able to test for this (the absence of a write), and I'd argue you should test for it as otherwise you can't know if your optimization is actually working (which is something we care about, as otherwise there'd be no point in putting it there), no matter how convincing the code looks. 🙂
I'm wiling to let this pass - against my own best judgement - if you tell me that writing such a test is complicated.
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.
I think that skipping writes is not such a crucial feature that would justify having a test that verify if something was called or not called (one of the worst kinds of tests imo), but I've added such test anyway.
9bcef1a
to
e1046b6
Compare
e1046b6
to
c151f93
Compare
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.
I like it
This is an optimization only. No functionality is changed, therefore no need to update any tests.